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

时间:2019-04-18 15:25:00

标签: python pycharm virtualenv python-3.6

我最近从Ubuntu 18.04升级到具有19.04的{​​{1}}。但是我使用python 3.7处理许多项目。

现在,当我尝试在PyCharm中使用Python 3.6创建一个virtualenv时,它会引发:

Python 36

enter image description here

我不知道该怎么办。

我尝试安装distutils:

ModuleNotFoundError: No module named 'distutils.core'

但是您可以看到我有最新版本。

你知道该怎么办吗?

5 个答案:

答案 0 :(得分:8)

其他情况

这是在我的ubuntu升级到20.04之后在我的python3.7安装上发生的,但不是在我的主python3上发生的

Solution

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt install python3.7

答案 1 :(得分:6)

如果我在ubuntu 20.04(例如kubuntu 20.04)上有多个版本的python3(例如3.8主版本和ppa:deadsnakes / ppa中的3.9)它不起作用

sudo apt install python3-distutils

然后对我有用

sudo apt install python3.9-distutils

答案 2 :(得分:4)

Python基本解释器确实需要一些附加模块。这些未默认安装为18.04。 要解决缺少软件包的问题,​​请运行以下命令,然后重新启动pycharm

sudo apt-get install python3-distutils

refer to this article

答案 3 :(得分:0)

对我来说,问题是通过专门使用python3解决的,因此确保使用python3.8

import tkinter as tk
from tkinter import filedialog
window = tk.Tk()
window.wm_attributes('-topmost', 1)
window.withdraw()   # this supress the tk window

   filename = filedialog.askopenfilename(parent=window,
                                  initialdir="",
                                  title="Select A File",
                                  filetypes = (("Text files", "*.txt"), ("All files", "*")))
# Here, window.wm_attributes('-topmost', 1) and "parent=window" argument help open the dialog box on top of other windows

答案 4 :(得分:0)

当前,我正在使用ubuntu 18.04python 3.6.9。以mentioned here运行以下命令后,我的问题已解决:

sudo apt-get install python3-dev

更多详细信息:需要一些未安装的python模块。

相关问题