繁体   English   中英

setuptools,easy_install和自定义pypi服务器

[英]setuptools, easy_install, and a custom pypi server

我有一个自定义的pypi服务器正在运行,并且想知道如何将所有对https://pypi.python.org/的引用从那里指向我的自定义服务器?

我希望能够涵盖用户调用软件包的pip / easy_install的情况(这样他们就不必记住要执行-i-f ),以及使用setuptools和install_requires进行python setup.py install情况setup.py

我可以做一些全局配置或设置来获取所有这些不同方法来查看本地服务器吗? 我认为做一些网络代理类型的魔术来将http://pypi.python.org/路由到我的自定义服务器将是一种方法,但是不幸的是,这不是一种选择。

谢谢!

以下配置将禁用pypi存储库索引,并使您的索引成为pipeasy_install使用的唯一索引。 setuptools install命令基本上是在当前项目上运行easy_install命令的快捷方式。 因此,这也将起作用。

# 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_installpip的文档以获取更多信息。

您可以为您的用户提供一个简单的python脚本,为他们创建这些配置文件。

您需要更改2个文件:

对于distutils

  • 配置文件: doc

    • ~/.pydistutils.cfg对于Linux),
    • Windows的$HOME/pydistutils.cfg
  • 内容:

     [easy_install] index_url = YOUR_URL 

这涉及python setup.py install类的命令。

对于点

  • 配置文件: doc

    • ~/.pip/pip.conf对于Linux),
    • Windows的$HOME/pip/pip.conf
  • 内容:

     [global] index-url = YOUR_URL 

这涉及pip install mypackage命令。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM