Windows下Python2.7和Python3共存

Python 2.7 安装目录:C:\Program Files\Python27
Python 3.6 安装目录:C:\Program Files\Python36

重命名python.exe

C:\Program Files\Python36\python.exe 重命名为 C:\Program Files\Python36\python3.exe
C:\Program Files\Python36\pythonw.exe 重命名为 C:\Program Files\Python36\pythonw3.exe

安装easy_install及pip

下载地址:https://pypi.python.org/pypi/setuptools

> cd C:\Users\yezhou\Desktop\setuptools-39.0.1
> python setup.py install
> cd C:\Program Files\Python27\Scripts
> easy_install pip

> cd C:\Users\yezhou\Desktop\setuptools-39.0.1
> python3 setup.py install
> cd C:\Program Files\Python36\Scripts
> easy_install pip

注:使用管理员权限

删除:

  • C:\Program Files\Python27\Scripts\pip3.6.exe
  • C:\Program Files\Python27\Scripts\pip3.6-script.py
  • C:\Program Files\Python27\Scripts\pip3.exe
  • C:\Program Files\Python27\Scripts\pip3-script.py

环境变量

  • C:\Program Files\Python27\Scripts
  • C:\Program Files\Python27
  • C:\Program Files\Python36\Scripts
  • C:\Program Files\Python36

注意顺序

版本测试

> python -V
Python 2.7.14

> python3 -V
Python 3.6.5

> pip -V
pip 10.0.0b2 from C:\Program Files\Python27\lib\site-packages\pip-10.0.0b2-py2.7.egg\pip (python 2.7)
> pip3 -V
pip 10.0.0b2 from c:\program files\python36\lib\site-packages\pip-10.0.0b2-py3.6.egg\pip (python 3.6)

版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/04/01/coexistence-of-python-27-and-python-3-under-windows/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
海报
Windows下Python2.7和Python3共存
Python 2.7 安装目录:C:\Program Files\Python27 Python 3.6 安装目录:C:\Program Files\Python36 重命名python.exe C:\Program Files\Python36\python.exe……
<<上一篇
下一篇>>
文章目录
关闭
目 录