Python异常

Python异常

我在运行 lightdm-gtk-greeter-settings 或编译 python 应用程序时遇到这些错误。

我可以看到它与 python 相关,但不确定需要采取哪些步骤来解决。安装了Python默认3.5(也安装了2.7)

操作系统 Manjaro XFCE(基于 Arch 64)

有人可以告诉我问题是什么吗?

谢谢

Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/enum34-1.0.4-py3.5.egg/enum/__init__.py", line 371, in __getattr__
KeyError: '_convert'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/lightdm-gtk-greeter-settings", line 33, in <module>
    lightdm_gtk_greeter_settings.main()
  File "/usr/lib/python3.5/site-packages/lightdm_gtk_greeter_settings/__init__.py", line 24, in main
    from gi.repository import Gtk
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/usr/lib/python3.5/site-packages/gi/importer.py", line 115, in load_module
    dynamic_module = load_overrides(introspection_module)
  File "/usr/lib/python3.5/site-packages/gi/overrides/__init__.py", line 125, in load_overrides
    override_mod = importlib.import_module(override_package_name)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/lib/python3.5/site-packages/gi/overrides/Gtk.py", line 26, in <module>
    from gi.repository import GObject
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/usr/lib/python3.5/site-packages/gi/importer.py", line 115, in load_module
    dynamic_module = load_overrides(introspection_module)
  File "/usr/lib/python3.5/site-packages/gi/overrides/__init__.py", line 125, in load_overrides
    override_mod = importlib.import_module(override_package_name)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/lib/python3.5/site-packages/gi/overrides/GObject.py", line 31, in <module>
    from gi.repository import GLib
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/usr/lib/python3.5/site-packages/gi/importer.py", line 115, in load_module
    dynamic_module = load_overrides(introspection_module)
  File "/usr/lib/python3.5/site-packages/gi/overrides/__init__.py", line 125, in load_overrides
    override_mod = importlib.import_module(override_package_name)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/lib/python3.5/site-packages/gi/overrides/GLib.py", line 22, in <module>
    import signal
  File "/usr/lib/python3.5/signal.py", line 8, in <module>
    _IntEnum._convert(
  File "/usr/lib/python3.5/site-packages/enum34-1.0.4-py3.5.egg/enum/__init__.py", line 373, in __getattr__
AttributeError: _convert

答案1

您正在针对 python 3.5 运行此代码 - 但似乎 enum 仅针对 3.4 或更早版本运行。尝试运行/usr/bin/python2.7解释器。或早期的 Python 3<= 3.4

答案2

在 Freenode 上 #python 上的 The-Compiler 的一些出色帮助下,该问题现已修复。

cd /usr/lib/python3.5/site-packages; pacman -Qo * 2>&1 | grep '^error:'

删除 site-packages 目录中列出的所有包。

相关内容