在setup.py中为PyPI中的模块指定依赖关系URL

时间:2016-08-04 12:34:03

标签: python pip setuptools setup.py pypi

到目前为止,我在这里看到的问题涉及相反的情况,即providing a link to off-PyPI dependencies。就我而言,依赖项是在PyPI中发布的,但版本不符合我的要求。以下是我setup.py

的摘录
setup(
    ...
    install_requires=["numpy>=1.11.0",
                      "scipy>=0.17.0",
                      "lasagne",
                      "Theano>=0.8.1",
                      "scipy>=0.17.0"],

    dependency_links=["git+https://github.com/Lasagne/Lasagne.git#egg=lasagne"]
)

我需要从链接安装lasagne,而pip坚持安装PyPI版本。

修改即可。我试过这个

setup(
    ...
    install_requires=["numpy>=1.11.0",
                      "scipy>=0.17.0",
                      "lasagne>=0.2.dev1",
                      "Theano>=0.8.1",
                      "scipy>=0.17.0"],

    dependency_links=[
        "git+https://github.com/Lasagne/Lasagne.git#egg=lasagne-0.2.dev1"]
)

这导致Could not find a version that satisfies the requirement lasagne>=0.2.dev1

Edit2

实际上如here所示传递--process-dependency-links旗帜(感谢Nehal J. Wani)让它发挥作用。如何使此标志默认工作?我不想让用户感到困惑。

0 个答案:

没有答案