I have recently upgraded my Ubuntu 18.04 system from python3.7
to python3.8
. I now want to install a python3.8
package. So, I ran: python3.8 -m pip install xyz
, where xyz
is the package name (for example, I have tried torch
, numpy
, and opencv-python
for the package name, and all three packages give the same result). However, this gave the following error messages:
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)
So, I took a look at the content of /usr/lib/python3.8/distutils
. Indeed, there is no module named sysconfig
. In fact, there are only two files: __init__.py
and version.py
. However, when I look at the same for python3.7
in /usr/lib/python3.7/distutils
, I can then see the module sysconfig
.
I then tried to reinstall dstutils
for python3.8
, by running: sudo apt-get install python3.8-distutils
. However, this gave me the following error message:
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'
So now, I am really stuck! I seem to need distutils
to install any packages, but my installation of distutils
seems to be incomplete. And yet, I cannot seem to install distutils
using apt get
.
Please can somebody help?
apt
andapt-get
might get affected, for starters. – Hannu Dec 07 '20 at 18:23