如何解决处理 /usr/lib/python2.7/dist-packages/pygst.pth: 时的错误?

如何解决处理 /usr/lib/python2.7/dist-packages/pygst.pth: 时的错误?
Error processing line 1 of /usr/lib/python2.7/dist-packages/pygst.pth:

  Traceback (most recent call last):
    File "/usr/lib/python2.7/site.py", line 161, in addpackage
      if not dircase in known_paths and os.path.exists(dir):
    File "/usr/lib/python2.7/genericpath.py", line 18, in exists
      os.stat(path)
  TypeError: must be encoded string without NULL bytes, not str

Remainder of file ignored
Error processing line 1 of /usr/lib/python2.7/dist-packages/pygtk.pth:

  Traceback (most recent call last):
    File "/usr/lib/python2.7/site.py", line 161, in addpackage
      if not dircase in known_paths and os.path.exists(dir):
    File "/usr/lib/python2.7/genericpath.py", line 18, in exists
      os.stat(path)
  TypeError: must be encoded string without NULL bytes, not str

Remainder of file ignored
Traceback (most recent call last):
  File "/usr/share/apport/apport-gtk", line 16, in <module>
    from gi.repository import GObject
  File "/usr/lib/python2.7/dist-packages/gi/importer.py", line 76, in load_module
    dynamic_module._load()
  File "/usr/lib/python2.7/dist-packages/gi/module.py", line 222, in _load
    version)
  File "/usr/lib/python2.7/dist-packages/gi/module.py", line 90, in __init__
    repository.require(namespace, version)
gi.RepositoryError: Failed to load typelib file '/usr/lib/girepository-1.0/GLib-2.0.typelib' for namespace 'GLib': Invalid magic header

答案1

我看到您正在尝试安装python-gst0.10,它为 Python 提供 gstreamer 绑定。与该包关联的文件由以下程序找到dpkg -S,这些是出现错误的文件:

python-gst0.10: /usr/share/pyshared/pygst.py
python-gst0.10: /usr/lib/python2.7/dist-packages/pygst.pth
python-gst0.10: /usr/share/pyshared/pygst.pth
python-gst0.10: /usr/lib/python2.7/dist-packages/pygst.py

我注意到你已经尝试sudo apt-get -f installsudo dpkg --reconfigure -a它也可能值得尝试sudo dpkg --configure -a,因为它用于尚未正确配置的包;reconfigure用于已经成功配置的包。

但是,下载的软件包也可能存在一些损坏,因为 dpkg 尝试读取文件时会不断出现错误。因此,为了成功安装软件包,我们可以尝试使用以下命令重命名软件包当前损坏的列表文件:

sudo mv /var/lib/dpkg/info/python-gst0.10.list /var/lib/dpkg/info/python-gst0.10.list.old 

现在,当sudo apt-get update您运行并尝试安装软件包时,软件包列表将重新下载,您应该能够成功安装。这对我的其他软件包有用,但如果它不起作用,我们可以讨论更通用的方法来解决这些问题,例如运行sudo apt-get clean以清除软件包缓存。

相关内容