我最近将我的 Ubuntu 18.04 系统python3.7
从python3.8
. 我现在想安装一个python3.8
包。所以,我跑了:python3.8 -m pip install xyz
,xyz
包名在哪里(例如,我尝试过torch
、numpy
、 和opencv-python
包名,所有三个包都给出相同的结果)。但是,这给出了以下错误消息:
File "/usr/lib/python3.8/runpy.py", line 185, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.8/runpy.py", line 144, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.8/runpy.py", line 111, in _get_module_details
__import__(pkg_name)
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 29, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/usr/lib/python3/dist-packages/pip/utils/__init__.py", line 23, in <module>
from pip.locations import (
File "/usr/lib/python3/dist-packages/pip/locations.py", line 9, in <module>
from distutils import sysconfig
ImportError: cannot import name 'sysconfig' from 'distutils' (/usr/lib/python3.8/distutils/__init__.py)
于是,我看了一下内容/usr/lib/python3.8/distutils
。确实,没有名为sysconfig
. 实际上,只有两个文件:__init__.py
和version.py
. 但是,当我查看相同的python3.7
in 时/usr/lib/python3.7/distutils
,我可以看到 module sysconfig
。
然后我尝试通过运行dstutils
重新安装python3.8
:sudo apt-get install python3.8-distutils
但是,这给了我以下错误消息:
E: Unable to locate package python3.8-distutils
E: Couldn't find any package by glob 'python3.8-distutils'
E: Couldn't find any package by regex 'python3.8-distutils'
所以现在,我真的被困住了!我似乎需要distutils
安装任何软件包,但我的安装distutils
似乎不完整。然而,我似乎无法distutils
使用apt get
.
请问有人可以帮忙吗?