I have installed tkinter on my Raspberry Pi that is running Raspbian. It is installed for both python2 and python3. However while importing it in python3, it shows me an error:

>>> import tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/tkinter/__init__.py", line 35, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named '_tkinter'

While importing 'Tkinter' for python2, it works well. But for python3, it doesn't. I've tried all the solutions in other answers related to my problem on StackExchange. I have Python 3.5.1 and Python 2.7.13.

Thanks for your help.

  • tkinter is a built in part of python, so if you have python installed correctly it should work. How did you install python3? I ask because I see yours is installed in /usr/local/lib and if installed with apt, it installs to /usr/lib. Also your version of python is older, so what version of raspbian do you have? It may be as simple as updating your packages with sudo apt update and sudo apt upgrade
    – T. M.
    Feb 14, 2019 at 10:31
  • Thank you for your help. I formatted my SD Card, did a fresh install of the OS and the problem was resolved. Both python versions were already installed, turns out that I missed it at first and manually installed python 3.5.1. That could have caused it. Feb 14, 2019 at 14:55

1 Answer 1


In the world of Raspbian and for reasons that elude me,

from tkinter import *

works in python3 but not in python2 and

from Tkinter import * 

works in python2 but not in python3. (note the capital “T”)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.