在setup.py中使用额外的python包索引URL [英] Using an extra python package index url with setup.py

查看:95
本文介绍了在setup.py中使用额外的python包索引URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过setup.py使用额外的python软件包索引(ala pip --extra-index-url pypi.example.org mypackage),以便运行python setup.py install可以找到pypi.example.org上托管的软件包?

Is there a way to use an extra python package index (ala pip --extra-index-url pypi.example.org mypackage) with setup.py so that running python setup.py install can find the packages hosted on pypi.example.org?

推荐答案

如果您是软件包的维护者,并且想要在PyPi以外的其他地方托管软件包的一个或多个依赖项,则可以使用setuptools的Depend ="link =" 选项的"https://setuptools.readthedocs.io/zh-CN/latest/setuptools.html#new-and-changed-setup-keywords" >文件.这样,您就可以提供一个明确的位置,可以在其中放置包裹.

If you're the package maintainer, and you want to host one or more dependencies for your package somewhere other than PyPi, you can use the dependency_links option of setuptools in your distribution's setup.py file. This allows you to provide an explicit location where your package can be located.

例如:

from setuptools import setup

setup(
    name='somepackage',
    install_requires=[
        'somedep'
    ],
    dependency_links=[
        'https://pypi.example.org/pypi/somedep/'
    ]
    # ...
)

如果您托管自己的索引服务器,则需要提供指向包含每个鸡蛋的实际下载链接的页面的链接,而不是列出所有软件包的页面(例如,https://pypi.example.org/pypi/somedep/,而不是https://pypi.example.org/)

If you host your own index server, you'll need to provide links to the pages containing the actual download links for each egg, not the page listing all of the packages (e.g. https://pypi.example.org/pypi/somedep/, not https://pypi.example.org/)

这篇关于在setup.py中使用额外的python包索引URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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