无法安装pip
,出现错误
E: Unable to correct problems, you have held broken packages.
细节:
uname -a
Linux a123-45-678-90 4.4.0-116-generic #140~14.04.1-Ubuntu SMP Fri Feb 16 09:25:20 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
which python
/usr/local/bin/python
python --version
Python 2.7.6
which pip , doesn't output anything.
sudo apt-get install pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package pip
sudo apt-get update && sudo apt-get install python-pip
Ign http://dl.google.com stable InRelease
Hit http://dl.google.com stable Release.gpg
Hit http://dl.google.com stable Release
Hit http://dl.google.com stable/main amd64 Packages
Ign http://us.archive.ubuntu.com trusty InRelease
Hit http://security.ubuntu.com trusty-security InRelease
Get:1 http://us.archive.ubuntu.com trusty-updates InRelease [65.9 kB]
Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://ppa.launchpad.net trusty InRelease
Ign https://apt.datadoghq.com stable InRelease
Hit https://apt.datadoghq.com stable Release.gpg
Ign http://dl.google.com stable/main Translation-en_US
Hit http://us.archive.ubuntu.com trusty-backports InRelease
Hit http://security.ubuntu.com trusty-security/restricted Sources
Hit https://apt.datadoghq.com stable Release
Ign http://dl.google.com stable/main Translation-en
Hit https://apt.datadoghq.com stable/6 amd64 Packages
Hit https://apt.datadoghq.com stable/6 i386 Packages
Hit http://us.archive.ubuntu.com trusty Release.gpg
Get:2 https://apt.datadoghq.com stable/6 Translation-en_US
Hit http://security.ubuntu.com trusty-security/universe Sources
Get:3 http://us.archive.ubuntu.com trusty-updates/main Sources [427 kB]
Hit http://ppa.launchpad.net trusty InRelease
Hit http://security.ubuntu.com trusty-security/multiverse Sources
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://ppa.launchpad.net trusty InRelease
Get:4 http://us.archive.ubuntu.com trusty-updates/restricted Sources [6,322 B]
Get:5 http://us.archive.ubuntu.com trusty-updates/universe Sources [231 kB]
Hit http://security.ubuntu.com trusty-security/restricted amd64 Packages
Get:6 http://us.archive.ubuntu.com trusty-updates/multiverse Sources [7,424 B]
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Get:7 http://us.archive.ubuntu.com trusty-updates/main amd64 Packages [1,141 kB]
Hit http://ppa.launchpad.net trusty/main amd64 Packages
Ign https://apt.datadoghq.com stable/6 Translation-en_US
Ign https://apt.datadoghq.com stable/6 Translation-en
Hit http://security.ubuntu.com trusty-security/multiverse amd64 Packages
Get:8 http://us.archive.ubuntu.com trusty-updates/restricted amd64 Packages [17.2 kB]
Hit http://ppa.launchpad.net trusty/main i386 Packages
Hit http://security.ubuntu.com trusty-security/main i386 Packages
Get:9 http://us.archive.ubuntu.com trusty-updates/universe amd64 Packages [518 kB]
Get:10 http://us.archive.ubuntu.com trusty-updates/multiverse amd64 Packages [14.6 kB]
Hit http://security.ubuntu.com trusty-security/restricted i386 Packages
Get:11 http://us.archive.ubuntu.com trusty-updates/main i386 Packages [1,068 kB]
Hit http://ppa.launchpad.net trusty/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe i386 Packages
Get:12 http://us.archive.ubuntu.com trusty-updates/restricted i386 Packages [17.1 kB]
Get:13 http://us.archive.ubuntu.com trusty-updates/universe i386 Packages [500 kB]
Hit http://security.ubuntu.com trusty-security/multiverse i386 Packages
Get:14 http://us.archive.ubuntu.com trusty-updates/multiverse i386 Packages [15.0 kB]
Hit http://ppa.launchpad.net trusty/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://us.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://us.archive.ubuntu.com trusty-updates/multiverse Translation-en
Hit http://security.ubuntu.com trusty-security/multiverse Translation-en
Hit http://ppa.launchpad.net trusty/main i386 Packages
Hit http://security.ubuntu.com trusty-security/restricted Translation-en
Hit http://us.archive.ubuntu.com trusty-updates/restricted Translation-en
Hit http://us.archive.ubuntu.com trusty-updates/universe Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit http://us.archive.ubuntu.com trusty-backports/main Sources
Hit http://ppa.launchpad.net trusty/main Translation-en
Hit http://us.archive.ubuntu.com trusty-backports/restricted Sources
Hit http://us.archive.ubuntu.com trusty-backports/universe Sources
Hit http://us.archive.ubuntu.com trusty-backports/multiverse Sources
Hit http://us.archive.ubuntu.com trusty-backports/main amd64 Packages
Hit http://ppa.launchpad.net trusty/main amd64 Packages
Hit http://us.archive.ubuntu.com trusty-backports/restricted amd64 Packages
Hit http://us.archive.ubuntu.com trusty-backports/universe amd64 Packages
Hit http://us.archive.ubuntu.com trusty-backports/multiverse amd64 Packages
Hit http://ppa.launchpad.net trusty/main i386 Packages
Hit http://us.archive.ubuntu.com trusty-backports/main i386 Packages
Hit http://us.archive.ubuntu.com trusty-backports/restricted i386 Packages
Hit http://us.archive.ubuntu.com trusty-backports/universe i386 Packages
Hit http://us.archive.ubuntu.com trusty-backports/multiverse i386 Packages
Hit http://ppa.launchpad.net trusty/main Translation-en
Hit http://us.archive.ubuntu.com trusty-backports/main Translation-en
Hit http://us.archive.ubuntu.com trusty-backports/multiverse Translation-en
Hit http://us.archive.ubuntu.com trusty-backports/restricted Translation-en
Hit http://us.archive.ubuntu.com trusty-backports/universe Translation-en
Hit http://us.archive.ubuntu.com trusty Release
Hit http://us.archive.ubuntu.com trusty/main Sources
Hit http://us.archive.ubuntu.com trusty/restricted Sources
Hit http://us.archive.ubuntu.com trusty/universe Sources
Hit http://us.archive.ubuntu.com trusty/multiverse Sources
Hit http://us.archive.ubuntu.com trusty/main amd64 Packages
Hit http://us.archive.ubuntu.com trusty/restricted amd64 Packages
Hit http://us.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://us.archive.ubuntu.com trusty/multiverse amd64 Packages
Hit http://us.archive.ubuntu.com trusty/main i386 Packages
Hit http://us.archive.ubuntu.com trusty/restricted i386 Packages
Hit http://us.archive.ubuntu.com trusty/universe i386 Packages
Hit http://us.archive.ubuntu.com trusty/multiverse i386 Packages
Hit http://us.archive.ubuntu.com trusty/main Translation-en
Hit http://us.archive.ubuntu.com trusty/multiverse Translation-en
Hit http://us.archive.ubuntu.com trusty/restricted Translation-en
Hit http://us.archive.ubuntu.com trusty/universe Translation-en
Ign http://us.archive.ubuntu.com trusty/main Translation-en_US
Ign http://us.archive.ubuntu.com trusty/multiverse Translation-en_US
Ign http://us.archive.ubuntu.com trusty/restricted Translation-en_US
Ign http://us.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 4,029 kB in 7s (564 kB/s)
Reading package lists... Done
W: Ignoring Provides line with DepCompareOp for package gdb-minimal
W: Ignoring Provides line with DepCompareOp for package gdb-minimal
W: You may want to run apt-get update to correct these problems
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-colorama but it is not going to be installed
Depends: python-distlib but it is not going to be installed
Depends: python-html5lib but it is not going to be installed
Depends: python-pkg-resources but it is not going to be installed
Depends: python-requests but it is not going to be installed
Depends: python-setuptools (>= 0.6c1) but it is not going to be installed
Depends: python-six but it is not going to be installed
Depends: python:any (>= 2.7.5-5~)
Depends: python:any (< 2.8)
Recommends: python-dev-all (>= 2.6) but it is not installable
Recommends: python-wheel but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
我该如何解决这个问题E: Unable to correct problems, you have held broken packages
?这取决于什么dpkg
?我不确定/usr/***/dpkg
文件是否已被删除?尝试重新安装dpkg
,但没有成功。我不介意再试一次
如果这取决于dpkg
,我该如何从新鲜开始un-install
。re-install
答案1
问题似乎是由于外部存储库的存在而发生的。
首先删除所有外部存储库。
请参阅此帖子以获取帮助 如何删除 PPA?创建 sources.list 文件的备份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bac
- 用您最喜欢的编辑器打开
/etc/apt/sources.list
文件并删除所有内容。 - 到这里:http://repogen.simplylinux.ch/
- 选择您的国家。
- 选择版本。
- 勾选所有选项Ubuntu 分支。
- 勾选所有选项Ubuntu 更新除了建议的选项。
- 勾选所有选项Ubuntu 合作伙伴存储库 和Ubuntu 附加存储库。
- 单击生成列表。
- 复制编辑器中的输出并保存。
现在运行:
sudo apt-get clean
sudo apt-get update
sudo apt-get install -f