python2 python3共存方法

1.安装

下载python2,python3安装包,直接安装
python2安装路径:C:\Python27
python3安装路径:C:\Users\shuai\AppData\Local\Programs\Python\Python35-32\

2.配置环境变量

在计算机的环境变量中的path路径下添加python2python3exe路径以及script文件路径
python2
C:\Python27;
C:\Python27\Scripts;

python3
C:\Users\shuai\AppData\Local\Programs\Python\Python35-32;
C:\Users\shuai\AppData\Local\Programs\Python\Python35-32\Scripts;

3.pip命令更新

pip安装命令进行更新,如果不更新的话,当你用pip命令如:pip install cx_Oracle安装oracle软件时会出现如下错误:
Fatal error in launcher: Unable to create process using '"'

pip命令更新如下
python2 -m pip install --upgrade pip
python3 -m pip install --upgrade pip

以后再使用pip命令时,命令格式如下
python2 -m pip install XXX或者python3 -m pip install XXX
XXX软件就会安装在python2或者python3环境下

4.pycharm使用python2python3方法

pycharm--file--setting--project:XXX--Project Interpreter中设置python2或者python3exe路径即可
C:\Python27\python2.exe;

你可能感兴趣的:(python2 python3共存方法)