python - 具有嵌套依赖项的 Pip index-url 问题
问题描述
我目前在内部服务器上安装了一个 pip 镜像(这是一个离线网络)。访问它的 url 是http://pypi.python.org/simple。我在 ~/.pip/pip.conf 创建了一个配置文件,内容如下:
[global]
index-url = http://pypi.python.org/simple
trusted-host = pypi.python.org
我可以成功安装没有嵌套依赖项的包,例如通过执行pip3 install requests
. 我成功安装了请求、idna、chardet、certifi 和 urllib3 的输出。但是,当我需要从具有嵌套依赖项的 pip 安装某些东西时,例如 via pip3 install driller
,我会得到以下输出:
Collecting driller
Downloading driller-1.0.tar.gz
Collecting angr (from driller)
Downloading angr-8.19.2.4.tar.gz (758kB)
100% | | 768kB 75.7MB/s
Complete output from command python setup.py egg_info:
Download error on https://pypi.python.org/simple/pyvex/: [Errno 111] Connection refused -- Some packages may not be found!
...
对我来说很奇怪,错误是由于尝试访问https://pypi.python.org/simple而不是我通过http://pypi.python.org上的 index-url 指定的本地镜像而发生的。此外,如果我执行pip3 install pyvex
它安装就好了。当存在嵌套依赖项时,我是否错过了如何通过 pip install 命令传播我的 index-url/受信任的主机?
解决方案
我有完全相同的问题,并在StackOverflow上的这个线程中得到了答案。
这是解决方案
在您的系统上找到 Python 目录并将以下两行添加到distutils.cfg
文件夹中distutils
。如果配置文件尚不存在,请创建它。
[easy_install]
index_url = blablabla
推荐阅读
- java - 永久更新变量名 (IntelliJ)
- optaplanner - optaplanner 与 constraintprovider 有时会抛出 nulpointer 异常
- pyspark - PySpark:如何在 pyspark 中编写计算逻辑
- reactjs - 为什么添加输入事件侦听器会破坏反应中的托管输入?
- amazon-web-services - 如何从弹性beantalk中的平台挂钩设置环境变量?
- reactjs - 映射对象的函数抛出“预期分配或函数调用,而是看到一个表达式”
- verilog - 在 Verilog 中实现 floor 函数
- python - 我如何获得布尔答案以查看一个数据帧的索引是否包含另一个数据帧中列的所有元素但顺序不同
- ios - iOS - 选项卡未从 WKWebView 打开
- html - 如何将文本放入框中?