安装包时Python pip版本冲突

时间:2016-06-01 08:30:31

标签: python pip openstack-nova

我尝试使用pip安装python-novaclient==2,22包,但每次尝试都会出现此错误:

Installing collected packages: pbr, positional, keystoneauth1, python-keystoneclient
  Found existing installation: pbr 1.10.0
    Uninstalling pbr-1.10.0:
      Successfully uninstalled pbr-1.10.0
  Running setup.py install for positional
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-VjRZEU/positional/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-dJ_gyO-record/install-record.txt --single-version-externally-managed --compile:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-VjRZEU/positional/setup.py", line 26, in <module>
        pbr=True)
      File "/usr/lib64/python2.7/distutils/core.py", line 112, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 265, in __init__
        self.fetch_build_eggs(attrs.pop('setup_requires'))
      File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 289, in fetch_build_eggs
        parse_requirements(requires), installer=self.fetch_build_egg
      File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 630, in resolve
        raise VersionConflict(dist,req) # XXX put more info here
    pkg_resources.VersionConflict: (pbr 0.11.1 (/usr/lib/python2.7/site-packages), Requirement.parse('pbr>=1.8'))

    ----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-VjRZEU/positional/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-dJ_gyO-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-VjRZEU/positional

如您所见,卸载了pbr-1.10.0。由于某种原因,版本0.11.1替换它,之后安装失败,因为版本冲突。

这是一个已报告的错误,但我找不到任何解决此问题的方法。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

猜猜你使用python2,建议你使用conda:

conda create --name env1 python=2.7 并使用conda install yourlib 真的很方便。