无法安装python-dev

时间:2019-10-19 10:00:54

标签: python ubuntu

当我尝试在Ubuntu 14.04上为Python2安装python-dev, libxml2-dev, libxslt-dev时,出现以下错误:

E: Unable to correct problems, you have held broken packages
E: Unable to correct problems, you have held broken packages
E: Unable to correct problems, you have held broken packages
Reading package lists...
Building dependency tre...
Reading state information...
Some packaghes 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 nor been moved out of Incoming. 
The following information may help to resolve the situation:
The following packages have unmet dependecies:
python-dev : Depends: libpython-dev (= 2.7.5-5ubuntu3) but it is not going to be installed
Depends: python2.7-dev (>= 2.7.5-1~) but it is not going to be installed

要解决此问题,我到底需要做什么?错误不是很清楚...

1 个答案:

答案 0 :(得分:0)

您可能只需要修复不稳定状态。重新启动并尝试...

sudo apt-get update --fix-missing

sudo dpkg --configure -a

sudo apt-get install -f

如果仍然存在软件包损坏的问题,解决方案是手动编辑dpkg状态文件。

$ sudo nano /var/lib/dpkg/status #(you can use vim or gedit instead of nano)

找到损坏的程序包,然后删除有关该程序包的全部信息并保存文件。

# Unlock the dpkg – (message /var/lib/dpkg/lock)
sudo fuser -vki /var/lib/dpkg/lock
sudo dpkg --configure -a

来自this link