等同于setup.py中的--find-links [英] Equivalent for `--find-links` in `setup.py`

查看:65
本文介绍了等同于setup.py中的--find-links的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

setup.pypip--find-links/-f标志的等效项是什么.

What is the equivalent of --find-links / -f flag for pip in setup.py.

我知道dependency_links存在,但是需要指向特定文件,我想要类似于-f的东西,该东西可以指向链接列表,可以根据版本和操作系统从中选择软件包.

I know dependency_links exist, but that requires pointing to a specific file, I want something similar to -f that can point to a list of links from which the package can be selected based on version&os.

推荐答案

setuptools 上下文中,dependency_links选项应该可以满足您的需求.根据 setuptools 文档,此选项接受:

In a setuptools context the dependency_links option should do what you need. According to setuptools documentation, this option accepts:

包含直接下载链接的网页的URL

the URLs of web pages that contain direct download links

例如:

setuptools.setup(
    # ...
    dependency_links=[
        "http://peak.telecommunity.com/snapshots/",
    ],
)

关于 pip 的重要说明:

Important note regarding pip:

自版本 19.0 于2019-01-22发布以来, pip 忽略 setuptools 选项dependency_links. pip 上下文中的解决方案是使用

Since its version 19.0, released on 2019-01-22, pip ignores the setuptools options dependency_links. The solution in a pip context is to use one of the pip install options --index-url, --extra-index-url, or --find-links.

pip 决定放弃对 setuptools dependency_links的支持的理由是(很简短): pip 仅应从 PyPI 下载,除非用户自己明确承担了使用上述任一选项从其他来源进行下载的责任.可以在此讨论中找到更多详细信息.

The rationale behind the decision for pip to drop the support of setuptools dependency_links is (in very short): pip should only download from PyPI unless the user themselves explicitly takes the responsibility to allow downloads from alternatives sources by using one of these previously mentioned options. More details can be found for example in this discussion.

这篇关于等同于setup.py中的--find-links的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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