步骤:

1、安装python3 并添加环境变量
2、修改python3 目录下文件名:修改python.exe 为python3.exe, 修改pythonw.exe 为pythonw3.exe
  C:\Users\Administrator\AppData\Local\Programs\Python\Python36
3、执行命令:python3 -m pip install --upgrade pip --force-reinstall
4、安装python2并添加环境变量: C:\Python2;C:\Python27\Scripts
5、修改C:\Python2目录下文件名:修改python.exe 为python2.exe, 修改pythonw.exe 为pythonw2.exe
6、执行命令:python -m pip install --upgrade pip --force-reinstall
验证:分别执行
pip -- version
python --version
python3 --version
pip2 --version
pip3 --version

python 2 python3 共存_python

 

共存一段时间后如果pip install 出现如下错误:

You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

需要重新配置下pip

配置python3的pip :python3 -m pip install --upgrade pip --force-reinstall
配置python2的pip: python2 -m pip install --upgrade pip --force-reinstall