我无法在 Ubuntu14.04 上打开软件更新程序和 Unity 调整工具

我无法在 Ubuntu14.04 上打开软件更新程序和 Unity 调整工具

几乎每次尝试更新时,我都会收到一条通知。该通知显示“检查更新时发生错误 => [TR 语言] 已确认更新已解决。”

我无法打开软件更新程序、语言、Unity 调整工具。

$ sudo unity-tweak-tool
Traceback (most recent call last):
  File "/usr/bin/unity-tweak-tool", line 33, in <module>
    import UnityTweakTool
  File "/usr/lib/python3/dist-packages/UnityTweakTool/__init__.py", line 39, in <module>
    import dbus, dbus.service
  File "/usr/lib/python2.7/dist-packages/dbus/__init__.py", line 82, in <module>
    import dbus.types as types
  File "/usr/lib/python2.7/dist-packages/dbus/types.py", line 6, in <module>
    from _dbus_bindings import (
ImportError: /usr/lib/python2.7/dist-packages/_dbus_bindings.so: undefined symbol: _Py_ZeroStruct
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 20, in <module>
    import apt
  File "/usr/lib/python2.7/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ImportError: /usr/lib/python2.7/dist-packages/apt_pkg.so: undefined symbol: _Py_ZeroStruct

Original exception was:
Traceback (most recent call last):
  File "/usr/bin/unity-tweak-tool", line 33, in <module>
    import UnityTweakTool
  File "/usr/lib/python3/dist-packages/UnityTweakTool/__init__.py", line 39, in <module>
    import dbus, dbus.service
  File "/usr/lib/python2.7/dist-packages/dbus/__init__.py", line 82, in <module>
    import dbus.types as types
  File "/usr/lib/python2.7/dist-packages/dbus/types.py", line 6, in <module>
    from _dbus_bindings import (
ImportError: /usr/lib/python2.7/dist-packages/_dbus_bindings.so: undefined symbol: _Py_ZeroStruct

以下描述为建议

打印import syssys.path

$ python
>> import sys
>> sys.path
''
['', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']

which pythonpython --version

~$ which python
/usr/bin/python

~$ python --version
Python 2.7.6

答案1

如果您查看回溯的顶部,您会注意到这UnityTweakTool是一个 Python 3 库。但是,您的PYTHONPATH包含许多引用 Python 2 安装的目录。有问题的是/usr/lib/python2.7/dist-packages,这导致不兼容的 Python 2 版本的软件包apt被拾取。

尝试取消设置PYTHONPATH或运行

sudo PYTHONPATH= unity-tweak-tool

相关内容