ModuleNotFoundError:在Python 3.8.0 Mac OS 10.15.3上没有名为'_tkinter'的模块

时间:2020-02-10 04:31:57

标签: python tkinter

在带有pyenv的Mac OS 10.15.3(Catalina)上使用Python 3.8.0。

当我尝试运行文件时,它返回:

ModuleNotFoundError: No module named '_tkinter'

我已经尝试过brew install tcl-tk。我有点担心,因为我在pyenv上运行python,所以任何第三方tkinter模块都无法正常运行。

运行brew doctor返回:

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
  `/Users/jm/.pyenv/shims/python3.7-config
  /Users/jm/.pyenv/shims/python3.7m-config
  /Users/jm/.pyenv/shims/python-config
  /Users/jm/.pyenv/shims/python3-config
  /Users/jm/.pyenv/shims/python3.8-config`

3 个答案:

答案 0 :(得分:3)

尝试了很多东西后,这就是它最终的工作方式:

$ brew install python-tk

答案 1 :(得分:0)

您应该安装 tkinter。要安装 tkinter,请在控制台上写入:

pip install tk

答案 2 :(得分:0)

尝试使用 pip3 它在我的 pip3 install tk 中工作