python-配置pip源

來源:互聯網
上載者:User

標籤:路徑   overflow   latest   first   ber   clip   com   武漢   python   

可以配置pip源的路徑:
三種形式:
1.Per-user:
UNIX default configuration fileHOME/.config/pip/pip.confmacOHOME/Library/Application Support/pip/pip.conf
HOME/.config/pip/pip.conf(如果HOME/Library/Application Support/pip/不存在)
Windows:%APPDATA%\pip\pip.ini
legacy per-user configuration file(遺留的per-user配置方式):
UNIX:$HOME/.pip/pip.conf
Windows:%HOME%\pip\pip.ini

2.Inside a virtualenv:
Unix and macOS:$VIRTUAL_ENV/pip.conf
Windows:%VIRTUAL_ENV%\pip.ini

3.Site-wide:
Unix:/etc/pip.conf
MacOS:/Library/Application Support/pip/pip.conf
Windows XP:C:\Documents and Settings\All Users\Application Data\pip\pip.ini
Windows7或之後:C:\ProgramData\pip\pip.ini

系統讀取順序(注意後面會覆蓋前面):

1.Firstly the site-wide file is read, then2.The per-user file is read, and finally3.The virtualenv-specific file is read.

筆者使用的是windows7,將pip.ini配置在%APPDATA%\pip\下。
如果不清楚%APPDATA%在哪裡,可以進入cmd,輸入set命令。
:

在%APPDATA%\下建立pip檔案夾,在pip檔案夾下建立pip.ini文字檔。

其中index-url指定的是pip源ip地址
筆者使用的是清華大學源。國內比較好用的源有:
pypi.python.org 官方源
pypi.douban.com 豆瓣源,福州
pypi.hustunique.com 華中科技大學源,武漢
pypi.tuna.tsinghua.edu.cn 清華源,北京

http://pypi.mirrors.ustc.edu.cn/simple/ 中國科學技術大學

不嫌麻煩的話,也可以手動指定源
pip install -i xx(其中xx是指定的源ip地址)

參考網址:
https://pip.pypa.io/en/latest/user_guide/

python-配置pip源

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.