我正在使用 Gentoo Linux 并安装了 Python 3.10 和 3.11。我有一个 Crossover 20.0.4 的注册版本,我正在尝试使用.bin
安装程序安装它,但遇到此错误并且安装失败:
Traceback (most recent call last):
File "/home/dev/Software/cxoffice/lib/python/cxconfig.py", line 12, in <module>
from collections import MutableMapping
ImportError: cannot import name 'MutableMapping' from 'collections' (/usr/lib/python3.11/collections/__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dev/Software/cxoffice/bin/cxtie", line 135, in <module>
import cxtiemain
File "/home/dev/Software/cxoffice/lib/python/cxtiemain.py", line 6, in <module>
import c4parser
File "/home/dev/Software/cxoffice/lib/python/c4parser.py", line 10, in <module>
import cxproduct
File "/home/dev/Software/cxoffice/lib/python/cxproduct.py", line 7, in <module>
import cxconfig
File "/home/dev/Software/cxoffice/lib/python/cxconfig.py", line 15, in <module>
from UserDict import DictMixin as MutableMapping
ModuleNotFoundError: No module named 'UserDict'
我并不是唯一一个遇到这个问题的人:
有这个线程:https://www.codeweavers.com/support/forums/general/?ft=25;t=26;msg=267771
以及这个询问 Ubuntu 的问题:https://askubuntu.com/questions/1437185/cant-install-packages-after-trying-to-install-deb-file
我如何安装它还是必须升级?
答案1
错误的堆栈跟踪源自该文件/home/dev/Software/cxoffice/lib/python/cxconfig.py
。MutableMapping
在失败之前尝试导入两次。
我编辑/path/to/cxoffice/lib/python/cxconfig.py
并更改了导入块
try:
# pylint: disable=E0611
from collections import MutableMapping
from collections import Mapping
except ImportError:
from UserDict import DictMixin as MutableMapping
from UserDict import DictMixin as Mapping
到
try:
# pylint: disable=E0611
from collections import MutableMapping
from collections import Mapping
except ImportError:
try:
from UserDict import DictMixin as MutableMapping
from UserDict import DictMixin as Mapping
except ImportError:
from collections.abc import MutableMapping
from collections.abc import Mapping
我能够从我的 Codeweavers 安装中成功安装、注册并运行一个 Bottle。
这可能特别有用,因为 CodeWeavers(在论坛链接中)提到他们不会解决该问题,解决方案只是升级。我将来可能会升级,但我不希望那些需要旧版本才能工作的人失去这个解决方案。