我使用过 Ubuntu 15.04,但它崩溃了。我想使用更稳定的操作系统,所以我重新安装了 Ubuntu 14.04。在安装 Ubuntu 14.04 时,我格式化了“/”目录,并使用了原始的“/home”目录,而没有格式化。但是当我输入
sudo apt-get install python3-pip
发生了一个错误:
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:
python3-pip : Depends: python3-setuptools but it is not going to be installed
Recommends: build-essential but it is not going to be installed
Recommends: python3-dev (>= 3.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
所以我只需输入以下命令:
sudo apt-get update
sudo apt-get autoremove
sudo apt-get -f install
我再次尝试,仍然出现同样的错误。因此我尝试了“aptitude”,如下所示:
sudo aptitude install python3-pip
The following NEW packages will be installed: build-essential{a} dpkg-dev{ab} g++{a} g++-4.8{ab} libalgorithm-diff-perl{a} libalgorithm-diff-xs-perl{a} libalgorithm-merge-perl{a} libexpat1-dev{ab} libpython3-dev{a} libpython3.4-dev{ab} libstdc++-4.8-dev{ab} python3-colorama{a} python3-dev{a} python3-distlib{a} python3-html5lib{a} python3-pip python3-requests{a} python3-setuptools{ab} python3-urllib3{a} python3.4-dev{ab}
0 packages upgraded, 20 newly installed, 0 to remove and 0 not upgraded.
Need to get 36.9 MB of archives. After unpacking 77.2 MB will be used.
The following packages have unmet dependencies:
libstdc++-4.8-dev : Depends: gcc-4.8-base (= 4.8.2-19ubuntu1) but 4.8.4-2ubuntu1~14.04 is installed.
Depends: libgcc-4.8-dev (= 4.8.2-19ubuntu1) but 4.8.4-2ubuntu1~14.04 is installed.
libpython3.4-dev : Depends: libpython3.4-stdlib (= 3.4.0-2ubuntu1) but 3.4.0-2ubuntu1.1 is installed.
Depends: libpython3.4 (= 3.4.0-2ubuntu1) but 3.4.0-2ubuntu1.1 is installed.
dpkg-dev : Depends: libdpkg-perl (= 1.17.5ubuntu5) but 1.17.5ubuntu5.4 is installed.
python3.4-dev : Depends: python3.4 (= 3.4.0-2ubuntu1) but 3.4.0-2ubuntu1.1 is installed.
Depends: libpython3.4 (= 3.4.0-2ubuntu1) but 3.4.0-2ubuntu1.1 is installed.
libexpat1-dev : Depends: libexpat1 (= 2.1.0-4ubuntu1) but 2.1.0-4ubuntu1.1 is installed.
g++-4.8 : Depends: gcc-4.8-base (= 4.8.2-19ubuntu1) but 4.8.4-2ubuntu1~14.04 is installed.
Depends: gcc-4.8 (= 4.8.2-19ubuntu1) but 4.8.4-2ubuntu1~14.04 is installed.
python3-setuptools : Depends: python3-pkg-resources (= 3.3-1ubuntu1) but 3.3-1ubuntu2 is installed.
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) build-essential [Not Installed]
2) dpkg-dev [Not Installed]
3) g++ [Not Installed]
4) g++-4.8 [Not Installed]
5) libexpat1-dev [Not Installed]
6) libpython3-dev [Not Installed]
7) libpython3.4-dev [Not Installed]
8) libstdc++-4.8-dev [Not Installed]
9) python3-dev [Not Installed]
10) python3-pip [Not Installed]
11) python3-setuptools [Not Installed]
12) python3.4-dev [Not Installed]
Leave the following dependencies unresolved:
13) python3-pip recommends build-essential
14) python3-pip recommends python3-dev (>= 3.2)
Accept this solution? [Y/n/q/?] y
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
我输入“Y”来接受解决方案,但没有发生任何事情来修复损坏的软件包。该怎么办?
kl@kali:~$ apt-cache policy python3-pip python3-setuptools python3-dev build-essential
python3-pip:
Installed: (none)
Candidate: 1.5.4-1
Version table:
1.5.4-1 0
500 http://ftp.sjtu.edu.cn/ubuntu/ trusty/universe amd64 Packages
python3-setuptools:
Installed: (none)
Candidate: 3.3-1ubuntu1
Version table:
3.3-1ubuntu1 0
500 http://ftp.sjtu.edu.cn/ubuntu/ trusty/main amd64 Packages
python3-dev:
Installed: (none)
Candidate: 3.4.0-0ubuntu2
Version table:
3.4.0-0ubuntu2 0
500 http://ftp.sjtu.edu.cn/ubuntu/ trusty/main amd64 Packages
build-essential:
Installed: (none)
Candidate: 11.6ubuntu6
Version table:
11.6ubuntu6 0
500 http://ftp.sjtu.edu.cn/ubuntu/ trusty/main amd64 Packages
kl@kali:~$ apt-cache policy libstdc++-4.8-dev gcc-4.8-base
libstdc++-4.8-dev:
Installed: (none)
Candidate: 4.8.2-19ubuntu1
Version table:
4.8.2-19ubuntu1 0
500 http://ftp.sjtu.edu.cn/ubuntu/ trusty/main amd64 Packages
gcc-4.8-base:
Installed: 4.8.4-2ubuntu1~14.04
Candidate: 4.8.4-2ubuntu1~14.04
Version table:
*** 4.8.4-2ubuntu1~14.04 0
100 /var/lib/dpkg/status
4.8.2-19ubuntu1 0
500 http://ftp.sjtu.edu.cn/ubuntu/ trusty/main amd64 Packages
kl@kali:~$ sudo apt-get install gcc-4.8-base=4.8.2-19ubuntu1 libgcc-4.8-dev=4.8.2-19ubuntu1 gcc-4.8=4.8.2-19ubuntu1
[sudo] password for kl:
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:
gcc-4.8 : Depends: cpp-4.8 (= 4.8.4-2ubuntu1~14.04) but it is not going to be installed
Depends: gcc-4.8-base (= 4.8.4-2ubuntu1~14.04) but 4.8.2-19ubuntu1 is to be installed
Depends: libgcc-4.8-dev (>= 4.8.4-2ubuntu1~14.04) but 4.8.2-19ubuntu1 is to be installed
libgcc-4.8-dev : Depends: libgomp1 (>= 4.8.2-19ubuntu1) but it is not going to be installed
Depends: libitm1 (>= 4.8.2-19ubuntu1) but it is not going to be installed
Depends: libatomic1 (>= 4.8.2-19ubuntu1) but it is not going to be installed
Depends: libasan0 (>= 4.8.2-19ubuntu1) but it is not going to be installed
Depends: libtsan0 (>= 4.8.2-19ubuntu1) but it is not going to be installed
Depends: libquadmath0 (>= 4.8.2-19ubuntu1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
答案1
未解决,见下文
降级
gcc-4.8-base
,libgcc-4.8-dev
并且gcc-4.8
,您需要版本4.8.2-19ubuntu1
而不是(手动?)安装的版本4.8.4-2ubuntu1~14.04
sudo apt-get install gcc-4.8-base=4.8.2-19ubuntu1 libgcc-4.8-dev=4.8.2-19ubuntu1 gcc-4.8=4.8.2-19ubuntu1
维修
sudo apt-get install -f
安装
python3-pip
sudo apt-get install python3-pip
OP 决定:重新安装系统