dpkg:error handlingpython-minimal(–configure)

当我运行sudo apt-get upgrade ,会出现dpkg错误并中断该进程。

错误详情:

 Setting up python-minimal (2.7.3-0ubuntu7.1) ... Traceback (most recent call last): File "/usr/local/lib/python2.7/runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/local/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/usr/local/lib/python2.7/compileall.py", line 16, in  import struct File "/usr/local/lib/python2.7/struct.py", line 1, in  from _struct import * ImportError: No module named _struct dpkg: error processing python-minimal (--configure): subprocess installed post-installation script returned error exit status 255 dpkg: dependency problems prevent configuration of python: python depends on python-minimal (= 2.7.3-0ubuntu7.1); however: Package python-minimal is not configured yet. 

在处理以下包时,此问题会导致一系列依赖性问题:

  python gwibber-service libgwibber3 libgwibber-gtk3 gwibber gwibber-service-facebook gwibber-service-identica gwibber-service-twitter python-all python-dev python-all-dev python-apt python-problem-report python-apport python-libxml2 unity-lens-gwibber unity-scope-video-remote 

任何帮助表示赞赏! ^ _ ^

编辑:

最后,我无法解决这个问题。 几天后,根目录已满,我甚至无法卸载任何软件,因为这个问题。

所以我能做的就是重新安装系统。 ╮(╯_╰)╭

按照Soroosh的解决方案。 手动构建和安装python 2.6后损坏python(2.7)

输入sudo -i以进行root访问。

粘贴命令并等待大约20分钟。 完美运行。

 for pkg in $(dpkg --get-selections | egrep -v 'deinstall' | egrep python | awk '{print $1}'); do apt-get -y --force-yes install --reinstall $pkg ; done 

好的,通过这些包,我发现python-minimal没有struct.py,但是python-minimal2.7没有。

所以,试试这个,看看它是否会帮助你:

 sudo apt-get install --reinstall python2.7-minimal sudo apt-get upgrade 

即使这不起作用,也许你的$ PYTHONPATH会以某种方式混乱。

 nano ~/.bashr 

添加行export PYTHONPATH="${PYTHONPATH}:/usr/lib/python2.7"然后

 source ~/.bashrc 

并再次尝试更新。

不知道这是否会帮助你,它在黑暗中有点刺,但要确保你的默认Python版本设置为2.7。

/ usr / bin中有三个受关注的文件:

 python (symlink) python2.7 python3 (symlink) 

如果你做ls -l /usr/bin | grep python ls -l /usr/bin | grep python你会看到每个符号链接指向的内容。

如果它显示你python -> python3python -> python3.3那就错了。 此时你需要:

 rm /usr/bin/python ln -s /usr/bin/python2.7 /usr/bin/python