简体   繁体   中英

How can I install tkinter for Python on Mac?

So I posted this error on a Facebook group, they said I should get pip. I installed pip, when I am wanting to install tkinter it's giving me error:

I used this command first:

sudo pip install tkinter

.
.
.
error:

ERROR: Could not find a version that satisfies the requirement tkinter (from versions: none)
ERROR: No matching distribution found for tkinter

tkinter is part of the standard library. You don't need to install it. You can import it with import tkinter .

After a day of headache, this worked for me:

$ brew install python-tk

Just FYI, pip has tkinter with the name tk , so you should do

$ pip install tk

I've had the same issue:

ModuleNotFoundError: No module named 'tkinter'

After quite a while I finally realized that I needed to install the python-tk package. On Linux all I needed to do was sudo apt-get install python3-tk .

Thanks all, fixed my issue. The problem was with my xcode version.

Here's my solution

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