python pip 升級 或者換源


1. 臨時換源
python -m pip install --upgrade pip -i https://pypi.douban.com/simple

pip國內的一些鏡像

  阿里雲  https://mirrors.aliyun.com/pypi/simple/
  中國科技大學  https://pypi.mirrors.ustc.edu.cn/simple/
  豆瓣(douban)  http://pypi.douban.com/simple/
  清華大學  https://pypi.tuna.tsinghua.edu.cn/simple/
  中國科學技術大學  http://pypi.mirrors.ustc.edu.cn/simple/

 
        

 2. Windows下python2和python3的共存設置

 https://blog.csdn.net/weixin_39986952/article/details/84794537


3. pip 在Windows 永久性換源:

  1、打開appdata文件夾,在資源管理器的地址欄輸入%appdata%后回車:
  2、新建一個pip文件夾,在pip文件夾里面新建一個配置文件pip.ini
  3、在配置文件中輸入如下內容后保存即可:
[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
 
        

  在 Linux  換源:

# 找到~/.pip/pip.conf,如果不存在就創建
# 加入
[global]
timeout = 10 # 設置超時,單位s
index-url =  http://mirrors.aliyun.com/pypi/simple/   # 指定優先下載源
extra-index-url= http://pypi.douban.com/simple/   # 第二下載源
[install]
trusted-host=   # 可能需要使用https方式通信
    mirrors.aliyun.com
    pypi.douban.com

 






免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM