Unable to install any package using Pip [duplicate

2019-02-20 04:35发布

This question already has an answer here:

Whenever I run the command pip install Django I get the following error trace which means there is some version conflict. I tried uninstalling and then installing the same package, but it's throwing up the same error.

Downloading/unpacking bcrypt (from Django)
  Downloading bcrypt-2.0.0.tar.gz
  Running setup.py (path:/tmp/pip_build_root/bcrypt/setup.py) egg_info for package bcrypt
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_root/bcrypt/setup.py", line 226, in <module>
        **keywords_with_side_effects(sys.argv)
      File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 225, in __init__
        _Distribution.__init__(self,attrs)
      File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
        self.finalize_options()
      File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 257, in finalize_options
        ep.require(installer=self.fetch_build_egg)
      File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2029, in require
        working_set.resolve(self.dist.requires(self.extras),env,installer))
      File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 592, in resolve
        raise VersionConflict(dist,req) # XXX put more info here
    pkg_resources.VersionConflict: (certifi 2016.2.28 (/usr/local/lib/python2.7/dist-packages), Requirement.parse('certifi==2015.11.20'))
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip_build_root/bcrypt/setup.py", line 226, in <module>

    **keywords_with_side_effects(sys.argv)

  File "/usr/lib/python2.7/distutils/core.py", line 111, in setup

    _setup_distribution = dist = klass(attrs)

  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 225, in __init__

    _Distribution.__init__(self,attrs)

  File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__

    self.finalize_options()

  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 257, in finalize_options

    ep.require(installer=self.fetch_build_egg)

  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2029, in require

    working_set.resolve(self.dist.requires(self.extras),env,installer))

  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 592, in resolve

    raise VersionConflict(dist,req) # XXX put more info here

pkg_resources.VersionConflict: (certifi 2016.2.28 (/usr/local/lib/python2.7/dist-packages), Requirement.parse('certifi==2015.11.20'))

----------------------------------------
Cleaning up...

I am using Python 2.7. Anybody knows what is the issue?

2条回答
欢心
2楼-- · 2019-02-20 05:15

It seems like all the problem is because of certifi version conflict

so try downloading the source from here https://pypi.python.org/pypi/certifi

and install from source

Extract it go into the folder and run this command

sudo python setup.py  install

and it should work

peace

查看更多
手持菜刀,她持情操
3楼-- · 2019-02-20 05:27

I met such a situation when I had already used system package manager like aptitude or pacman to install that very package, or dependency package (they, pip and system package manager, do not know each other, while they install package at the same folder, some site-package thing, so it's easy to get a file already exist like problem)

You need to see which is conflict, open your python console, try to import it, and see where is it with module_name.file, remove it(or the folder) manually (please backup before problem really solved).

Or just use pip and system package manager to verify which has been already installed

查看更多
登录 后发表回答