【发布时间】:2017-08-22 22:27:49
【问题描述】:
Using /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
Admins-MacBook-Pro:Desktop admin$ pip install python-tk
Collecting python-tk
Could not find a version that satisfies the requirement python-tk (from versions: )
No matching distribution found for python-tk
Admins-MacBook-Pro:Desktop admin$
Admins-MacBook-Pro:Desktop admin$ python
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
Admins-MacBook-Pro:Desktop admin$ sudo apt-get install python3-tk #python3
Password:
sudo: apt-get: command not found
Admins-MacBook-Pro:Desktop admin$ import Tkinter as tk
-bash: import: command not found
Admins-MacBook-Pro:Desktop admin$ from Tkinter import *
from: can't read /var/mail/Tkinter
Admins-MacBook-Pro:Desktop admin$
Admins-MacBook-Pro:Desktop admin$
【问题讨论】:
-
请注意,在 python3 中,模块都是小写的
tkinter,如果缺少模块,install it using brew -
这能回答你的问题吗? How to get Tkinter working on mac