user2395350
user2395350

Reputation: 11

Can't seem to import Tkinter for python

Hello and thanks for looking at this,

When I try to import tkinter it says unresolved import

ImportError: No module named tkinter

There was some kind of error when I installed python originally

Here are the paths:

Output:

/Library/Python/2.7/site-packages
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-     scriptpackages
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/Users/wes/Desktop/UM/Python/guiTest
/Users/wes/Desktop/UM/Python/guiTest/testgui

Thanks -Wes

Upvotes: 1

Views: 5866

Answers (2)

user2418076
user2418076

Reputation: 1

Finally figured it out! Thanks. My mac comes with python 2.7 in system/Library and auto config defalts to this however this is not the version that I downloaded and updated.The version that I downloaded went into Library not System and the Capital T in Tkinter was important as you said for 2.7 Thanks for your help

Upvotes: 0

A. Rodas
A. Rodas

Reputation: 20679

You are importing tkinter with lowercase T. The code you posted in your comment is for Python 3.X, and the import statements are correct if you have that version too, but since you are using Python 2.7, the names for the modules are Tkinter and tkMessageBox (instead of tkinter and tkinter.messagebox).

Upvotes: 1

Related Questions