python 中pip配置清華源


python pip anaconda conda 切換國內源(清華鏡像)

 

anaconda配置鏡像

Mac and Linux

1
2
conda config --add channels https: //mirrors .tuna.tsinghua.edu.cn /anaconda/pkgs/free/
conda config -- set  show_channel_urls  yes

 Windows

  windows下,直接在user目錄中創建一個pip目錄,如:C:\Users\xx\pip,新建文件pip.ini,內容如下

1
2
[global]
index-url = https: //pypi.tuna.tsinghua.edu.cn/simple

 

pip配置鏡像 

Linux

修改 ~/.pip/pip.conf (沒有就創建一個), 修改 index-url至tuna,內容如下:

 

1
2
[global]
  index-url = https: //pypi.tuna.tsinghua.edu.cn/simple

 

 Windows

直接在user目錄中創建一個pip目錄,如:C:\Users\xx\pip,新建文件pip.ini,內容如下

1
2
[global]
  index-url = https: //pypi.tuna.tsinghua.edu.cn/simple

 請注意:一定是在你個人用戶文件夾下先建立pip文件夾,在建立pip.ini文件,不是直接把pip.ini文件放在C:\Users\xx\下

 

pip臨時鏡像

 

臨時使用:

 

可以在使用pip的時候加參數-i https://pypi.tuna.tsinghua.edu.cn/simple

 

例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gevent,這樣就會從清華這邊的鏡像去安裝gevent庫。

當遇到pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.tuna.tsinghua.edu.cn', port=443): Read timed out.

 

 

 比如我使用   :easy_install pip  就會出現這個超時,建議更換成豆瓣源使用   -i https://pypi.doubanio.com/simple


免責聲明!

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



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