报错如下

# apt-get -y install  python
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 : PreDepends: python-minimal (= 2.7.12-1~16.04) but it is not going to be installed
          Depends: python2.7 (>= 2.7.12-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

解决方案

用这条命令看你损坏的包然后卸载了

#查看包
dpkg --get-selections | grep python
#卸载
sudo apt-get remove libpython2.7
sudo apt-get remove libpython2.7-minimal
sudo apt-get remove libpython2.7-stdlib

把有关的包都卸载了,然后再

sudo apt-get insatll python
Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐