1、安装Python的多个版本
例如,我在Window中安装了python2.7-64、python2.7-32和python3.7三个版本。
2、环境变量配置:
在环境变量的Path中添加python和pip的启动路径
D:\Software\Python27\ --安装python2.7-64启动路径;
D:\Software\Python27\Scripts --安装python2.7-64时候pip等相关启动路径;
D:\Software\Python27_x86\ --安装python2.7-32启动路径;
D:\Software\Python27_x86\Scripts --安装python2.7-32时候pip等相关启动路径;
D:\Software\Python37\ --安装python3.7启动路径;
D:\Software\Python37\Scripts --安装python3.7时候pip等相关启动路径;
3、Python多版本启动和pip install
方法1:修改启动文件(不推荐,需要修改启动文件)
将D:\Software\Python27\python.exe拷贝一份,重命名为python2.exe
#python2.7-64
python2
python2 -m pip install xxxxxx
将D:\Software\Python27_x86\python.exe拷贝一份,重命名为python2_x86.exe
#python2.7-32
python2_x86
python2_x86 -m pip install xxxxxx
将D:\Software\Python37\python.exe拷贝一份,重命名为python3.exe
#python3.7
python3
python3 -m pip install xxxxxx
方法2:py.exe参数识别(推荐,不需要任何修改)
#python2.7-64
py -2
py -2 -m pip install xxxxxx
#python3.7
py -3
py -3 -m pip install xxxxxx
网友评论