【轉載】如何修改Python中pip的更新源(python換源、pip換源)

Linux 下:

建個文件 ~/.pip/pip.conf, 內容如下:

[global]
timeout = 6000
index-url = http://pypi.douban.com/simple/

[install]
use-mirrors = true
mirrors = http://pypi.douban.com/simple/
trusted-host = pypi.douban.com

Windows下:

1.本機特定目錄下創建pip目錄:

(python安裝時選擇“僅當前用戶使用”)本機User的appdata目錄下創建pip目錄,可能是以下路徑

  • C:\Users\{你的用戶名}\AppData\Local\pip

  • C:\Users\用戶名}\AppData\Roaming

(python安裝時選擇“所有用戶使用”)本機User的目錄下創建pip目錄,

  • C:\Users\{你的用戶名}\pip

2.新建pip.ini文件,內容如下:

[global]
timeout = 6000
index-url = http://pypi.douban.com/simple
trusted-host = http://pypi.douban.com

pipy國內鏡像:

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章