从 15.10 升级到 16.04 后,我的 Python 包似乎损坏了。看起来像是 python-minimal 的编译错误。
me@me:/etc/apt/sources.list.d$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
libpython-dbg libpython-dev libpython-stdlib python
Suggested packages:
python-doc python-tk
The following packages will be upgraded:
libpython-dbg libpython-dev libpython-stdlib python
4 upgraded, 0 newly installed, 0 to remove and 1208 not upgraded.
5 not fully installed or removed.
Need to get 0 B/160 kB of archives.
After this operation, 113 kB disk space will be freed.
Do you want to continue? [Y/n] y
Setting up python-minimal (2.7.11-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 <module>
import struct
File "/usr/local/lib/python2.7/struct.py", line 1, in <module>
from _struct import *
ImportError: /usr/local/lib/python2.7/site-packages/_struct.so: undefined symbol: _Py_RefTotal
dpkg: error processing package python-minimal (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
python-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
我不知道它从何而来,但我在 /usr/local/bin 中有一个 python 二进制文件,它覆盖了我的默认二进制文件。它是用较旧的 gcc 构建的,这导致了问题。