【发布时间】:2016-11-14 09:12:27
【问题描述】:
我正在尝试使项目依赖于 git 依赖项。但是,我似乎无法让它工作。我基本上想要实现的是以下,但它不起作用:
#!/usr/bin/env python3
from setuptools import setup
setup(
name='spam',
version='0.0.0',
install_requires=[
'git+https://github.com/remcohaszing/pywakeonlan.git'
])
我在上面尝试了几种变体,例如添加@master或#egg=wakeonlan-0.2.2,但这并没有什么不同。
以下方法有效,但仅在使用已弃用的 pip 标志 --process-dependency-links 时有效:
#!/usr/bin/env python3
from setuptools import setup
setup(
name='spam',
version='0.0.0',
install_requires=[
'wakeonlan'
],
dependency_links=[
'git+https://github.com/remcohaszing/pywakeonlan.git#egg=wakeonlan-0.2.2'
])
这个输出:
$ pip install --no-index -e . --process-dependency-links
Obtaining file:///home/remco/Downloads/spam
DEPRECATION: Dependency Links processing has been deprecated and will be removed in a future release.
Collecting wakeonlan (from spam==0.0.0)
Cloning https://github.com/remcohaszing/pywakeonlan.git to /tmp/pip-build-mkhpjcjf/wakeonlan
DEPRECATION: Dependency Links processing has been deprecated and will be removed in a future release.
Installing collected packages: wakeonlan, spam
Running setup.py install for wakeonlan ... done
Running setup.py develop for spam
Successfully installed spam wakeonlan-0.2.2
以下确实有效:
pip install 'git+https://github.com/remcohaszing/pywakeonlan.git'
在需求文件中添加 git url 也可以。
是否有任何不推荐使用的方式来使用 setup.py 文件来依赖 git url?
【问题讨论】:
-
不,答案建议使用已弃用的dependency_links。
-
一个相关的 github 问题:github.com/pypa/pip/issues/2023 - 但是我还没有看到解决方案。
-
目前,似乎没有不推荐使用的方法:\
标签: python git pip setuptools