指定Python安裝包下載地址

有時安裝包從pypi.org下載不了,或者網絡限制或使用內部倉庫。

Pip Configure.

Windows: ~\pip\pip.ini

Linux: ~.pip\pip.conf

[global]
index-url= http://mirrors.aliyun.com/pypi/simple/
extra-index-url= https://pypi.org/simple

[install]
trusted-host=mirrors.aliyun.com

Pip Install

命令行裏再指定也可以。

也支持本地安裝。不過,這是個痛苦的過程,就像Maven、Npm等其他依賴管理工具一樣。

pip install --help


Package Index Options:
  -i, --index-url <url>       Base URL of Python Package Index (default 
                              https://pypi.org/simple). This should point
                              to a repository compliant with PEP 503 (the simple repository API) or a local directory
                              laid out in the same format.
  --extra-index-url <url>     Extra URLs of package indexes to use in addition to --index-url. Should follow the same
                              rules as --index-url.
  --no-index                  Ignore package index (only looking at --find-links URLs instead).
  -f, --find-links <url>      If a url or path to an html file, then parse for links to archives. If a local path or
                              file:// url that's a directory, then look for archives in the directory listing.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章