How to pip or easy_install tkinter on Windows

Dirk Calloway picture Dirk Calloway · Nov 18, 2013 · Viewed 686.2k times · Source

My Idle is throwing errors that and says tkinter can't be imported.

Is there a simple way to install tkinter via pip or easy_install?

There seem to be a lot of package names flying around for this...

This and other assorted variations with tkinter-pypy aren't working.

pip install python-tk

I'm on Windows with Python 2.7 and I don't have apt-get or other system package managers.

Answer

IcyFlame picture IcyFlame · Nov 18, 2013

The Tkinter library is built-in with every Python installation. And since you are on Windows, I believe you installed Python through the binaries on their website?

If so, Then most probably you are typing the command wrong. It should be:

import Tkinter as tk

Note the capital T at the beginning of Tkinter.

For Python 3,

import tkinter as tk