setuptools,easy_install和自定义pypi服务器 [英] setuptools, easy_install, and a custom pypi server
问题描述
我有一个自定义的pypi服务器正在运行,并且想知道如何将所有引用指向 https://pypi. python.org/从那里到我的自定义服务器?
I've got a custom pypi server running and am wondering how to point all references to https://pypi.python.org/ from there to my custom server?
我希望能够涵盖某个用户调用某程序包的pip
/easy_install
的情况(因此他们不必记住要执行-i
或-f
)以及执行此操作的人的情况python setup.py install
与setup.py
中的install_requires
一起使用setuptools.
I want to be able to cover cases of a user calling pip
/ easy_install
of a package (so they don't have to remember to do -i
or -f
) as well as someone doing python setup.py install
using setuptools with install_requires
in the setup.py
.
是否可以执行一些全局配置或设置来获取所有这些不同的方法来查看我的本地服务器?我想做一些网络代理类型的魔术来将http://pypi.python.org/
路由到我的自定义服务器是一种方法,但是不幸的是,这不是一种选择.
Is there some global config or setting I can do to get all these different methods to look at my local server? I imagine doing some network-proxy-type magic to route http://pypi.python.org/
to my custom server would be one way to go but unfortunately that's not an option.
谢谢!
推荐答案
以下配置将禁用pypi存储库索引,并使您的索引成为pip
和easy_install
使用的唯一索引. setuptools install
命令基本上是在当前项目上运行easy_install
命令的快捷方式.因此,这也将起作用.
The following configuration will disable the pypi repository index and make your index the only index used by pip
and easy_install
. The setuptools install
command is basically a shortcut to run the easy_install
command on the current project. So, that would work too.
# Add the following to ~/.pydistutils.cfg for easy_install
[easy_install]
index_url = http://localhost:8000/
# Add the following to ~/.pip/pip.conf for pip
[global]
index-url = http://localhost:8000/
查看 easy_install的和您可以为您的用户提供一个简单的python脚本,该脚本可为他们创建这些配置文件.
You could provide your users with a simple python script that creates these config files for them.
这篇关于setuptools,easy_install和自定义pypi服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!