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)
上一篇 pip3异常No module named 'pip._internal'
下一篇 Win64安装MySQL-python
目录
文章列表
1 Android架构之MVC、MVP、MVVM
Android架构之MVC、MVP、MVVM
2
Android中Bitmap、Drawable、byte[]互转
Android中Bitmap、Drawable、byte[]互转
3
AWS WAF 配置
AWS WAF 配置
4
Node环境部署
Node环境部署
5
Android基础之LinearLayout
Android基础之LinearLayout
最新评论
一位WordPress评论者
一位WordPress评论者
2月12日
您好,这是一条评论。若需要审核、编辑或删除评论,请访问仪表盘的评论界面。评论者头像来自 Gravatar。