破了pip3和easy_install3:DistributionNotFound

时间:2015-05-17 15:16:06

标签: python pip

我的pip3似乎被打破了:

$ pip3 --version
Traceback (most recent call last):
  File "/usr/bin/pip3", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2708, in <module>
    working_set.require(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 686, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 584, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==1.5.6

我尝试使用pip3重新安装easy_install3来解决此问题,但easy_install3也已损坏:

$ sudo easy_install3 --upgrade pip3
Traceback (most recent call last):
  File "/usr/bin/easy_install3", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2708, in <module>
    working_set.require(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 686, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 584, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: distribute==0.6.24dev-r0

从apt重新安装pip3也无济于事。

$ sudo apt-get remove python3-pip
$ sudo apt-get install --fix-missing -t testing python3-pip

我正在运行Debian 7(稳定版)。我从测试库安装了Python 3.4.2。

2 个答案:

答案 0 :(得分:8)

让一切恢复正常的最简单方法可能是下载get-pip.py,然后运行

sudo python3 get-pip.py

这会将pip升级到最新版本(目前为6.1.1)并同时更新setuptools

答案 1 :(得分:6)

我必须下载并运行两个脚本,get-pip.pyez_setup.py

sudo python3 get-pip.py
sudo python3 ez_setup.py

那些修复了pip3和easy_install3。