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

查看:24
本文介绍了等效于 `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:

自 2019 年 1 月 22 日发布 19.0 版本以来,pip 忽略setuptools 选项<代码>dependency_links.pip 上下文中的解决方案是使用 pip install 选项 --index-url--extra-index-url--find-links.

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天全站免登陆