Под python 2.7 я хочу установить mock-2.0.0 и получил следующую ошибку:
Marker evaluation failed, see the following error. For more information see: http://docs.openstack.org/developer/pbr/compatibility.html#evaluate-marker
ERROR:root:Error parsing
Traceback (most recent call last):
File "/histor/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/pbr/core.py", line 96, in pbr
attrs = util.cfg_to_args(path, dist.script_args)
File "/histor/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/pbr/util.py", line 261, in cfg_to_args
kwargs = setup_cfg_to_setup_kwargs(config, script_args)
File "/histor/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/pbr/util.py", line 455, in setup_cfg_to_setup_kwargs
if pkg_resources.evaluate_marker('(%s)' % env_marker):
File "/histor/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1515, in evaluate_marker
return cls.interpret(parser.expr(text).totuple(1)[1])
File "/histor/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1549, in interpret
return op(nodelist)
File "/histor/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1463, in atom
return cls.interpret(nodelist[2])
File "/histor/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1549, in interpret
return op(nodelist)
File "/histor/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1484, in comparison
raise SyntaxError(msg)
SyntaxError: '<' operator not allowed in environment markers
error in setup command: Error parsing /histor/kang/yangpc/soft/Python/Python_packages/mock-2.0.0/setup.cfg: SyntaxError: '<' operator not allowed in environment markers
Через некоторое время, погуглив, я понял, что эта ошибка была вызвана более старой версией setuptools ( обсуждение 1 и обсуждение 2 ).
Содержимое файла setup.cfg:
[metadata]
name = mock
summary = Rolling backport of unittest.mock for all Pythons
home-page = https://github.com/testing-cabal/mock
description-file = README.rst
author = Testing Cabal
author-email = testing-in-python@lists.idyll.org
classifier =
Development Status :: 5 - Production/Stable
Environment :: Console
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.2
Programming Language :: Python :: 3.3
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: Jython
Programming Language :: Python :: Implementation :: PyPy
Topic :: Software Development :: Libraries
Topic :: Software Development :: Libraries :: Python Modules
Topic :: Software Development :: Testing
keyword =
testing, test, mock, mocking, unittest, patching, stubs, fakes, doubles
[extras]
test =
unittest2>=1.1.0
docs =
jinja2<2.7:python_version<"3.3" and python_version>="3"
Pygments<2:python_version<"3.3" and python_version>="3"
sphinx<1.3:python_version<"3.3" and python_version>="3"
sphinx:python_version<"3" or python_version>="3.3"
[files]
packages = mock
[bdist_wheel]
universal = 1
[egg_info]
tag_build =
tag_date = 0
tag_svn_revision = 0
Однако, после тестирования setuptools версии 15.2, 27.3.0, 38.0.0 и последней 40.2.0 ошибка остается. Я понятия не имею, как отладить эту проблему сейчас.
Все установки пакетов python были выполнены с использованием
python setup.py install --prefix=/histor/kang/yangpc/soft/Python/python2.7/
Спасибо!
Я попробовал следующий тест
1. using pip
1.1 pip install mock==2.0.0
/histor/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/pip-7.0.0.dev0-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Collecting mock==2.0.0
/histor/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/pip-7.0.0.dev0-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
/histor/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/pip-7.0.0.dev0-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Could not find a version that satisfies the requirement mock==2.0.0 (from versions: )
No matching distribution found for mock==2.0.0
1.2 pip install mock
/histor/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/pip-7.0.0.dev0-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Collecting mock
/histor/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/pip-7.0.0.dev0-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
/histor/kang/yangpc/soft/Python/python2.7/lib/python2.7/site-packages/pip-7.0.0.dev0-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Could not find a version that satisfies the requirement mock (from versions: )
No matching distribution found for mock
Это вызвало другой вопрос , решение которого я не нашел.
обновление
Эта проблема была решена путем обновления python с 2.7 до 2.7.15 и переустановки всех зависимых пакетов.
Спасибо всем!