我指定在无人机管道中安装pytest,如下所示:
pip install -q pytest它曾经工作得很好,直到几天前,它突然显示以下错误:
+ python -m pytest test/test_dai_adrecogzer.py
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/dist-packages/pytest.py", line 14, in <module>
from _pytest.fixtures import fillfixtures as _fillfuncargs
File "/usr/local/lib/python2.7/dist-packages/_pytest/fixtures.py", line 16, in <module>
from more_itertools import flatten
File "/usr/local/lib/python2.7/dist-packages/more_itertools/__init__.py", line 1, in <module>
from more_itertools.more import * # noqa
File "/usr/local/lib/python2.7/dist-packages/more_itertools/more.py", line 329
def _collate(*iterables, key=lambda a: a, reverse=False):
^
SyntaxError: invalid syntax我到处搜索,发现了一个recently post SO question,它似乎与我正在寻找的东西紧密相关。原因似乎是因为最近发布的more-itertools 6.0版本。公认的答案是使用spin连接到某个特定版本的more-itertools
setuptools.setup(
setup_requires=['pytest-runner'],
tests_require=['mock', 'more-itertools<6.0.0', 'pytest'],
test_suite='tests',
python_requires='>=2.7',
)我如何将此建议应用于我的问题?更具体地说,在使用more-itertools命令安装pytest时,如何指定pip install -q pytest的<6.0.0版本?
发布于 2019-02-13 17:24:34
您可以指定一个包含旧版本more-itertools的pytest版本(例如: pip install pytest==3.5.0)。
我不会建议使用其他版本的更多迭代器安装pytest,而不是setuptools中指定的版本,因为它可能会导致其他崩溃(pytest它可能在某些点上取决于您的降级版本没有的一些功能)。
发布于 2019-02-13 17:48:23
根据pytest package specs on PyPI的说法,该包需要more-itertools >=4.0.0。我假设,如果您在运行pip install -q pytest之前显式安装了低于6.0.0和高于或等于4.0.0的任何合适的more-itertools版本,那么在运行more-itertools之前,应该已经满足了对pytest的依赖检查,并且您可以安装最新版本的pytest。
https://stackoverflow.com/questions/54665997
复制相似问题