在我的setup.py中,我在required_libraries
参数中指定了许多库。这些通常具有以下形式:oauthlib==2.0.6
。现在我还想使用托管在远程URL的轮子来安装库:http://ci.tensorflow.org/view/Nightly/job/nightly-pi-zero/lastSuccessfulBuild/artifact/output-artifacts/tensorflow-1.4.0-cp27-none-any.whl
。只需将此作为条目添加到required_libraries
列表中就会导致错误:
'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Invalid requirement,....
有关setuptools的文档没有多大帮助。有没有人有这种安装的经验?我想这会是一个常见问题,但我可能在搜索错误的单词
答案 0 :(得分:2)
使用dependency_links
参数;这在setuptools
docs中有所描述。例如:
from setuptools import setup
setup(
install_requires=['tensorflow'],
dependency_links=[
'http://ci.tensorflow.org/view/Nightly/job/nightly-pi-zero/lastSuccessfulBuild/artifact/output-artifacts/tensorflow-1.7.0-cp27-none-any.whl',
],
)
运行安装脚本:
$ python setup.py install
running install
running bdist_egg
running egg_info
...
Processing dependencies for spam==0.0.0
Searching for tensorflow
Downloading http://ci.tensorflow.org/view/Nightly/job/nightly-pi-zero/lastSuccessfulBuild/artifact/output-artifacts/tensorflow-1.7.0-cp27-none-any.whl
Best match: tensorflow 1.7.0
Processing tensorflow-1.7.0-cp27-none-any.whl
Installing tensorflow-1.7.0-cp27-none-any.whl to /Users/hoefling/.virtualenvs/stackoverflow-py27/lib/python2.7/site-packages
writing requirements to /Users/hoefling/.virtualenvs/stackoverflow-py27/lib/python2.7/site-packages/tensorflow-1.7.0-py2.7.egg/EGG-INFO/requires.txt
Adding tensorflow 1.7.0 to easy-install.pth file
Installing toco_from_protos script to /Users/hoefling/.virtualenvs/stackoverflow-py27/bin
Installing saved_model_cli script to /Users/hoefling/.virtualenvs/stackoverflow-py27/bin
Installing freeze_graph script to /Users/hoefling/.virtualenvs/stackoverflow-py27/bin
Installing toco script to /Users/hoefling/.virtualenvs/stackoverflow-py27/bin
Installing tensorboard script to /Users/hoefling/.virtualenvs/stackoverflow-py27/bin
Installed /Users/hoefling/.virtualenvs/stackoverflow-py27/lib/python2.7/site-packages/tensorflow-1.7.0-py2.7.egg
...