同時安裝python2和python3,并重新設置pip2和pip3
1.python2 和 python3 安裝
官網地址:https://www.python.org/downloads/
2.環境變量配置
在Path中添加:
- python2的安裝目錄:xxx\python2;xxx\python2\Scripts;
- python3的安裝目錄:xxx\python3;xxx\python3\Scripts;
對其安裝目錄下的python.exe和pythonw.exe重命名:python2.exe、pythonw2.exe(python3類似)
驗證(cmd):python2 -version/python3 -version
3.pip2 和 pip3 配置
執行:
- python2 -m pip install --upgrade pip --force-reinstall
- python3 -m pip install --upgrade pip --force-reinstall
驗證:pip2 -V/pip3 -V
注意:可能會因為網絡的問題安裝失敗,可再次執行安裝或通過代理安裝
參考:http://www.rzrgm.cn/fengxi177/p/16939399.html
4.pip替換國內源
阿里源:
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple
pip config set install.trusted-host mirrors.aliyun.com
清華源:
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip config set install.trusted-host pypi.tuna.tsinghua.edu.cn
國內源列表:
阿里云:https://mirrors.aliyun.com/pypi/simple
中國科技大學:https://pypi.mirrors.ustc.edu.cn/simple
豆瓣:https://pypi.douban.com/simple
清華大學:https://pypi.tuna.tsinghua.edu.cn/simple

浙公網安備 33010602011771號