Python pip源配置
pipy國(guó)內(nèi)鏡像目前有:
http://pypi.douban.com/ 豆瓣
http://pypi.hustunique.com/ 華中科技大學(xué)
http://pypi.sdutlinux.org/ 山東理工大學(xué)
http://pypi.mirrors.ustc.edu.cn/ 中國(guó)科學(xué)技術(shù)大學(xué)
Win7下配置pip源:
1、在win7用戶目錄下創(chuàng)建pip目錄,以用戶user為例:
C:Usersuserpip
2、在pip目錄下新建pip.ini文件:
C:Usersuserpippip.ini
3、配置文件內(nèi)容:
以下是一個(gè)簡(jiǎn)單的配置示例,供參考:
[global] index-url = http://pypi.douban.com/simple trusted-host = pypi.douban.com disable-pip-version-check = true timeout = 120 [install] ignore-installed = true no-dependencies = yes
Linux系統(tǒng)配置pip源:
1、創(chuàng)建~/.pip/pip.conf
2、pip.conf配置內(nèi)容同win7,如下:
[global] index-url = http://pypi.douban.com/simple trusted-host = pypi.douban.com disable-pip-version-check = true timeout = 120 [install] ignore-installed = true no-dependencies = yes
virtualenv下配置pip源:
1、在virtualenv目錄下創(chuàng)建env/pip.conf
2、pip.conf內(nèi)容同Linux,不再贅述。
手動(dòng)指定pip源:
pip install -i http://<mirror>/simple <package>
例如:
pip install -i http://pypi.douban.com/simple simplejson
只要pip命令中出現(xiàn)的選項(xiàng)都可以配置在配置文件中,比如直接輸入pip命令,會(huì)提示以下選項(xiàng),那么這些選項(xiàng)都可以寫在配置文件中:
General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring
environment variables and user configuration.
-v, --verbose Give more output. Option is additive, and can be
used up to 3 times.
-V, --version Show version and exit.
-q, --quiet Give less output. Option is additive, and can be
used up to 3 times (corresponding to WARNING,
ERROR, and CRITICAL logging levels).
--log <path> Path to a verbose appending log.
--proxy <proxy> Specify a proxy in the form
[user:passwd@]proxy.server:port.
--retries <retries> Maximum number of retries each connection should
attempt (default 5 times).
--timeout <sec> Set the socket timeout (default 120.0 seconds).
--exists-action <action> Default action when a path already exists:
(s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
--trusted-host <hostname> Mark this host as trusted, even though it does
not have valid or any HTTPS.
--cert <path> Path to alternate CA bundle.
--client-cert <path> Path to SSL client certificate, a single file
containing the private key and the certificate
in PEM format.
--cache-dir <dir> Store the cache data in <dir>.
--no-cache-dir Disable the cache.
--disable-pip-version-check
Don't periodically check PyPI to determine
whether a new version of pip is available for
download. Implied with --no-index.
可根據(jù)需要自行添加。
總結(jié)
以上是生活随笔為你收集整理的Python pip源配置的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Scrum Meeting 报告
- 下一篇: 传输层-TCP拥塞控制执行流程