我是python的新手并尝试使用setuptools(这似乎是获取CI依赖关系的推荐方法)。
遵循(以及其他指南)这些: http://flask.pocoo.org/docs/0.10/patterns/distribute/ https://pytest.org/latest/goodpractises.html#integration-with-setuptools-test-commands
我的setup.py说:
install_requires=['Flask','Flask-SQLAlchemy'],
然而,当我运行" setup.py test" Flask-SQLAlchemy已安装并失败:
(.venv)root@apb:/projectmanager# ./setup.py test
running test
Searching for Flask-SQLAlchemy
Reading https://pypi.python.org/simple/Flask-SQLAlchemy/
Best match: Flask-SQLAlchemy 2.0
Downloading https://pypi.python.org/packages/source/F/Flask-SQLAlchemy/Flask-SQLAlchemy-2.0.tar.gz#md5=06ae73194cca73b72e178f870d1dac7c
Processing Flask-SQLAlchemy-2.0.tar.gz
...
Installed /projectmanager/Flask_SQLAlchemy-2.0-py2.7.egg
Searching for Flask
Best match: Flask SQLAlchemy-2.0
Downloading https://pypi.python.org/packages/source/F/Flask-SQLAlchemy/Flask-SQLAlchemy-2.0.tar.gz#md5=06ae73194cca73b72e178f870d1dac7c
Processing Flask-SQLAlchemy-2.0.tar.gz
...
Installed /projectmanager/Flask_SQLAlchemy-2.0-py2.7.egg
Traceback (most recent call last):
File "./setup.py", line 135, in <module>
cmdclass = {'test': PyTest},
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/projectmanager/.venv/local/lib/python2.7/site-packages/setuptools/command/test.py", line 132, in run
self.distribution.install_requires)
File "/projectmanager/.venv/local/lib/python2.7/site-packages/setuptools/dist.py", line 287, in fetch_build_eggs
replace_conflicting=True,
File "/projectmanager/.venv/local/lib/python2.7/site-packages/pkg_resources.py", line 639, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: Flask
我不明白为什么会这样: a)无序处理依赖关系 b)没有找到Flask
由于这实际上是一个应用而不是一个库,使用pip和requirements.txt是一个选项,但我喜欢标准化setuptools带来的。
更新:指定&#39; Flask&gt; = 0.10.1&#39;解决问题 - 但为什么?系统上的任何位置都没有任何版本的烧瓶。
非常感谢