setup.py 不尊重 PIP_INDEX_URL [英] setup.py not honoring PIP_INDEX_URL

查看:47
本文介绍了setup.py 不尊重 PIP_INDEX_URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行本地 pypi 服务器.我可以通过使用 pip 命令的 -i 选项指定它或通过设置 PIP_INDEX_URL 环境变量来从此服务器安装软件包.当我安装具有先决条件的包时,setup.py 过去一直遵循 PIP_INDEX_URL 环境变量,从我的本地服务器中提取其他包.

I am running a local pypi server. I can install packages from this server by either specifying it with the -i option of the pip command or by setting the PIP_INDEX_URL environment variable. When I install a package that has prerequisites, setup.py has historically honored the PIP_INDEX_URL environment variable, pulling the additional packages from my local server.

但是,在最近安装的几个系统上,它的行为有所不同.例如,运行 python setup.py develop 失败,因为它试图从 pypi.python.org 安装必备软件包.

However, on a couple of systems that have been recently installed, it is behaving differently. Running, for instance, python setup.py develop fails because it tries to install prerequisites packages from pypi.python.org.

我已经更新了所有相关的 python 包(pythondistributevirtualenvpip 等...)在我正在测试的所有系统上,并继续看到这种差异.在我的原始"系统上,setup.py 从我的 PIP_INDEX_URL 环境变量中指定的 pypi 服务器下载先决条件.在较新的系统上,我似乎无法让它遵守这个变量.

I have updated all of the related python packages (python, distribute, virtualenv, pip, etc...) on all the systems I'm testing on and continue to see this discrepancy. On my "original" system, setup.py downloads prerequisites from the pypi server specified in my PIP_INDEX_URL environment variable. On the newer systems, I can't seem to make it honor this variable.

我错过了什么?

推荐答案

在与您的 setup.py 相同的文件夹中创建 setup.cfg 并包含以下内容:

Create setup.cfg in the same folder as your setup.py with following content:

[easy_install]
allow_hosts = *.myintranet.example.com

<小时>

来自:http://pythonhosted.org/setuptools/easy_install.html#restricting-downloads-with-allow-hosts

您可以使用 --allow-hosts (-H) 选项来限制 EasyInstall 将在哪些域上查找链接和下载.

You can use the --allow-hosts (-H) option to restrict what domains EasyInstall will look for links and downloads on.

--allow-hosts=None 完全阻止下载.


这篇关于setup.py 不尊重 PIP_INDEX_URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆