在Ubuntu 14.04上无法安装Python pip

7

这是我用来安装Python-pip的命令。

sudo apt-get install python-pip

我收到了以下错误信息。
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
 python-pip : Depends: python-setuptools (>= 0.6c1) but it is not going to be installed
              Recommends: python-dev-all (>= 2.6) but it is not installable
E: Unable to correct problems, you have held broken packages.

我已经安装了最新版本的python-dev

当我尝试使用sudo apt-get install python-setuptools安装python-setuptools时,我收到以下错误信息

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
 python-setuptools : Depends: python-pkg-resources (= 3.3-1ubuntu1) but 3.3-1ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.

请告诉我如何解决错误并引导我安装python-pip。

尝试运行 sudo apt-get autoremovesudo apt-get updatesudo apt-get upgrade,然后安装pip。 - utkbansal
1
调试Apt问题并不是一个编程主题。您可能会在https://askubuntu.com/上获得更好的帮助;但请注意,这是那里的常见问题解答,请在提问之前先搜索。至少要注意您需要包含哪些细节才能正确诊断根本原因(非标准源?)。 - tripleee
6个回答

26

在安装 python-pip 时遇到了相同的错误,以下命令解决了我的问题。

sudo apt-get install python-pkg-resources=3.3-1ubuntu1
sudo apt-get install python-setuptools

嗨,我遇到了类似的问题,想问一下您这个命令 sudo apt-get install python-pkg-resources=3.3-1ubuntu1 是什么意思?因为在我的 VPS 上运行此命令会降级我的 python-pkg-resources - Adiyat Mubarak

8

2
除了@seems推荐的解决方案外,我还必须运行这个。
apt-get update

(或)

sudo apt-get install python-setuptools python-dev build-essential 
sudo easy_install pip 

1
我有同样的问题,最终我放弃了并使用了以下方法:
sudo apt-get install python-pip

尝试过类似以下的内容后:
sudo apt-get install python-setuptools python-dev build-essential 

但是没有运气。所以我所做的就是:

然后

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py

心安......


0

只需运行此命令:

sudo apt-get update 

然后安装Python工具:

 sudo apt-get install python-pip
 sudo apt-get install python-dev
 sudo apt-get install build-essential

所有的软件包都将被安装,或者其中一些可能会显示已经是最新版本,这没关系。


0

我认为你应该尝试:

sudo apt-get install python-pkg-resources=3.3-1ubuntu1

然后:

sudo apt-get install python-pip python-dev build-essential

这肯定会解决你的问题。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接