简体   繁体   中英

ModuleNotFoundError: No module named '_tkinter' on python 3.8.0 mac OS 10.15.3

Using Python 3.8.0 on Mac OS 10.15.3 (Catalina) with pyenv.

When I try to run a file, it returns:

ModuleNotFoundError: No module named '_tkinter'

I've tried brew install tcl-tk . I'm a little worried that because I'm running python on top of pyenv, any third party tkinter module doesn't get run properly.

Running brew doctor returned:

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`

在尝试了很多事情之后,这就是它最终工作的方式:

$ brew install python-tk

You should install tkinter . To install tkinter write this on console:

pip install tk

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM