Ubuntu上的Python 3.10版本

cbwuti44  于 2022-11-02  发布在  Python
关注(0)|答案(1)|浏览(375)

我已经在Ubuntu 18.04(系统版本Python 3.6.9)上使用deadsnakes ppa安装了Python 3.10。我想使用Python 3.10安装一个数值包“Firedrake”。Firedrake没有安装默认的Python版本(3.6.9)。当我发出命令时:python3.10 firedrake-install(firedrake-install是安装firedrake的脚本),python3.10仍然尝试使用默认的python版本(3.6.9),最后出现以下错误:

Traceback (most recent call last):
File "/home/salil/firedrake-install", line 19, in
from pkg_resources import parse_version
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 77, in
import('pkg_resources.extern.packaging.requirements')
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/requirements.py", line 9, in
from pkg_resources.extern.pyparsing import stringStart, stringEnd, originalTextFor, ParseException
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 672, in _load_unlocked
File "", line 632, in _load_backward_compatible
File "/usr/lib/python3/dist-packages/pkg_resources/extern/init.py", line 43, in load_module
import(extant)
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/pyparsing.py", line 943, in
collections.MutableMapping.register(ParseResults)
AttributeError: module 'collections' has no attribute 'MutableMapping'

我对Python不是很熟悉,因此不知道如何修复这个错误;即如何强制python3.10使用/usr/lib/python3.10。

pod7payv

pod7payv1#

我遇到的问题似乎与此[bug](https://github.com/pypa/setuptools/issues/2988)有关。我可以通过以下方法解决此问题:git clone https://github.com/pypa/setuptools.git && cd setuptools && sudo python3.10 setup.py install,然后是curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
公平地说,我不了解bug的细节,但上面的两个命令解决了我的问题。

相关问题