失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > python配置pip_Python pip源配置

python配置pip_Python pip源配置

时间:2023-12-12 19:45:00

相关推荐

python配置pip_Python pip源配置

pipy国内镜像目前有:

Win7下配置pip源:

1、在win7用户目录下创建pip目录,以用户user为例:

C:\Users\user\pip

2、在pip目录下新建pip.ini文件:

C:\Users\user\pip\pip.ini

3、配置文件内容:

以下是一个简单的配置示例,供参考:

[global]

index-url = /simple

trusted-host =

disable-pip-version-check = truetimeout= 120[install]

ignore-installed = trueno-dependencies = yes

Linux系统配置pip源:

1、创建~/.pip/pip.conf

2、pip.conf配置内容同win7,如下:

[global]

index-url = /simple

trusted-host =

disable-pip-version-check = truetimeout= 120[install]

ignore-installed = trueno-dependencies = yes

virtualenv下配置pip源:

1、在virtualenv目录下创建env/pip.conf

2、pip.conf内容同Linux,不再赘述。

手动指定pip源:

pip install -i http:///simple

例如:

pip install -i /simple simplejson

只要pip命令中出现的选项都可以配置在配置文件中,比如直接输入pip命令,会提示以下选项,那么这些选项都可以写在配置文件中:

General Options:

-h, --help Show help.

--isolated Run pip inan isolated mode, ignoring

environment variables and user configuration.

-v, --verbose Give moreoutput. Option is additive, and can be

used up to 3times.

-V, --version Show version and exit.

-q, --quiet Give lessoutput. Option is additive, and can be

used up to 3times (corresponding to WARNING,

ERROR, and CRITICAL logging levels).

--log Path to a verbose appending log.

--proxy Specify a proxy inthe form

[user:passwd@]proxy.server:port.

--retries Maximum number of retries each connection should

attempt (default 5times).

--timeout Set the socket timeout (default 120.0seconds).

--exists-action Default action when a path already exists:

(s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.

--trusted-host Mark this host as trusted, even though it does

not have valid or any HTTPS.

--cert Path to alternate CA bundle.

--client-cert Path to SSL client certificate, a single filecontaining the private key and the certificate

inPEM format.

--cache-dir

--no-cache-dirDisable the cache.

--disable-pip-version-check

Don't periodically check PyPI to determine

whether a new version of pip is available fordownload. Implied with --no-index.

可根据需要自行添加。

如果觉得《python配置pip_Python pip源配置》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。