问题
I've recently upgraded from Ubuntu 18.04
to 19.04
which has python 3.7
. But I work on many projects using Python 3.6
.
Now when I try to create a virtualenv
with Python 36
in PyCharm, it raises:
ModuleNotFoundError: No module named 'distutils.core'
I can't figure out what to do.
I tried to install distutils:
milano@milano-PC:~$ sudo apt-get install python3-distutils
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-distutils is already the newest version (3.7.3-1ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
But as you can see I have the newest version.
Do you know what to do?
回答1:
Python base interpreter does require some additiional modules. Those are not installed with 18.04 as default. To solve the missing packages problem run the following and restart pycharm afterwards
sudo apt-get install python3-distutils
refer to this article
回答2:
Other Cases
This happened on my python3.7 installation but not my main python3 after i upgrade my ubuntu to 20.04
Solution:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt install python3.7
来源:https://stackoverflow.com/questions/55749206/modulenotfounderror-no-module-named-distutils-core