pip

可以在多个路径下找到pip.conf,没有则创建, 另外,还可以通过环境变量PIP_CONFIG_FILE来指定配置文件的路径。

Linux:

/etc/pip.conf

~/.pip/pip.conf

~/.config/pip/pip.conf

Windows:

%APPDATA%\pip\pip.ini

%HOME%\pip\pip.ini

C:\Documents and Settings\All Users\Application Data\PyPA\pip\pip.conf (Windows XP)

C:\ProgramData\PyPA\pip\pip.conf (Windows 7及以后)

Mac OSX:

~/Library/Application Support/pip/pip.conf

~/.pip/pip.conf

/Library/Application Support/pip/pip.conf

只要pip命令中出现的选项都可以配置在配置文件中(输入pip命令查看选型),这些选项都可以写在配置文件中。

[global]

index-url = http://pypi.douban.com/simple #豆瓣源,可以换成其他的源

extra-index-url = https://pypi.tuna.tsinghua.edu.cn/simple

trusted-host = pypi.tuna.tsinghua #清华

timeout = 120

pip支持install、download、uninstall、freeze、list、show、search、wheel、hash、completion等多条子命令,这些都可以分别配置。

以pip install为例

输入命令pip help install,就会提示pip install支持的所有选项,在配置文件中,就要部署在install选项下,示例如下:

[install]

ignore-installed = true

no-dependencies = yes

posted @ 2019-08-22 22:31  我喜欢旅行  阅读(332)  评论(0编辑  收藏  举报