- 1.配置环境变量
- 在环境变量的先后顺序决定了启动py2还是py3
- 2.修改可执行文件
- 对文件进行改名,e.g:testpython.exe,改名 testpython2.exe,testpython3.exe
-
- 使用py参数
- py -2 进入py2的运行环境
- py -3 进入py3的运行环境
- 4.python脚本
- #! python2 ,当脚本需要py2运行时,在脚本前加上,然后运行
- #! python3 ,当脚本需要py3运行时,在脚本前加上,然后运行
- pip安装问题
- py -2 -m pip install 包
- py -2 -m pip install -i https:pypi.douban.com/simple 包
- py -3 -m pip install 包
- py -3 -m pip install -i https:pypi.douban.com/simple 包
py2与py3共存
最新推荐文章于 2023-08-26 20:14:39 发布