Python ModuleNotFoundError: 没有名为“distutils.core”的模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/55749206/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 20:35:33  来源:igfitidea点击:

ModuleNotFoundError: No module named 'distutils.core'

pythonpycharmvirtualenvpython-3.6

提问by Milano

I've recently upgraded from Ubuntu 18.04to 19.04which has python 3.7. But I work on many projects using Python 3.6.

我最近从升级Ubuntu 18.0419.04拥有python 3.7。但是我使用Python 3.6.

Now when I try to create a virtualenvwith Python 36in PyCharm, it raises:

现在,当我尝试在 PyCharm 中创建virtualenvwithPython 36时,它会引发:

ModuleNotFoundError: No module named 'distutils.core'

enter image description here

在此处输入图片说明

I can't figure out what to do.

我不知道该怎么办。

I tried to install distutils:

我尝试安装 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?

你知道该怎么做吗?

回答by Cutton Eye

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

Python 基础解释器确实需要一些附加模块。默认情况下,这些未安装 18.04。要解决丢失的包问题,请运行以下命令并在之后重新启动 pycharm

sudo apt-get install python3-distutils

refer to this article

参考这篇文章