[英]pip.conf not paying attention to trusted-host
I have my pip.conf
file as follows:我的pip.conf
文件如下:
[global]
trusted-host = <private IP>
extra-index-url = http://<private IP>/pypi
However, whenever I try to install a package (just a test package) from the private pypi repo, I receive an error that instructs me to add --trusted-host <private IP>
.但是,每当我尝试从私有 pypi 存储库安装包(只是一个测试包)时,我都会收到一条错误消息,指示我添加--trusted-host <private IP>
。 If I do, I can successfully install the package, so I know that pip
is reading the pip.conf
file.如果我这样做了,我就可以成功安装包,所以我知道pip
正在读取pip.conf
文件。 Why isn't it respecting the trusted-host
config?为什么不尊重trusted-host
配置? I've triple checked that the IPs match in the config file.我已经三重检查了配置文件中的 IP 是否匹配。
Several blogs and cursory searches of Google seem to suggest that it should.谷歌的几个博客和粗略搜索似乎表明它应该。 ( https://pseudoscripter.wordpress.com/2016/05/07/pip-the-repository-located-at-some-ip-is-not-a-trusted-or-secure-host-and-is-being-ignored/ ) ( https://pseudoscripter.wordpress.com/2016/05/07/pip-the-repository-located-at-some-ip-is-not-a-trusted-or-secure-host-and-is-being -忽略/ )
Couldn't this be a problem of different pip.conf having different configurations?According to the official docs :这不会是不同pip.conf配置不同的问题吧?根据官方文档:
The names and locations of the configuration files vary slightly across platforms.配置文件的名称和位置因平台而异。 You may have per-user, per-virtualenv or site-wide (shared amongst all users) configuration.您可能有每个用户、每个虚拟环境或站点范围(在所有用户之间共享)的配置。
将我的 pip.conf 从 $HOME/.pip/pip.conf 复制到 /etc/pip.conf 并且它起作用了!
To check which config file is being looked at run: pip config --editor pathtoeditorofyourchoice edit
, this will open the linked ini file.要检查正在查看哪个配置文件,请运行: pip config --editor pathtoeditorofyourchoice edit
,这将打开链接的 ini 文件。 If it doesnt exist, the Editor (notepad++) will state that there is no file at a specific path <-- and there is your path where you should place the file then.如果它不存在,编辑器 (notepad++) 将声明在特定路径 <-- 没有文件,然后有你应该放置文件的路径。
Also consider as stated here ( https://pip.pypa.io/en/stable/user_guide ):还要考虑如下所述( https://pip.pypa.io/en/stable/user_guide ):
If multiple configuration files are found by pip then they are combined in the following order:如果 pip 找到多个配置文件,则它们按以下顺序组合:
The site-wide file is read The per-user file is read The virtualenv-specific file is read
Each file read overrides any values read from previous files, so if the global timeout is specified in both the site-wide file and the per-user file then the latter value will be used.每个文件读取都会覆盖从先前文件读取的任何值,因此如果在站点范围的文件和每个用户的文件中都指定了全局超时,则将使用后一个值。
The docs also say:文档还说:
You can set a custom path location for this config file using the environment variable PIP_CONFIG_FILE.您可以使用环境变量 PIP_CONFIG_FILE 为该配置文件设置自定义路径位置。
However, running the upper command with this environment variable set up lead to a但是,使用此环境变量设置运行上层命令会导致
Fatal Internal error [id=2]. Please report as a bug.
You might be using an old version of PIP.您可能正在使用旧版本的 PIP。 Try upgrading using:尝试升级使用:
python -m pip install --upgrade pip
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.