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

1
2
3
4
5
6
7
8
9
> 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

注意顺序

版本测试

1
2
3
4
5
6
7
8
9
10
> 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)

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2020 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :