ImportError DLL load failed importing _tkinter

paduraru2009 picture paduraru2009 · Jan 4, 2012 · Viewed 53.3k times · Source

I'm using python 2.7.2 and windows 7. I searched through internet, helps and other sources but i can't find an answer to my problem.

One of my source imports tkinter, and this one imports _tkinter. At this moment it say ImportError DLL load failed:

 Traceback (most recent call last): File "NERO/show_image.py", line 13,
 in <module> import Tkinter File "C:\Python27\lib\lib-tk\Tkinter.py", line 38,
 in <module> import FixTk File "C:\Python27\lib\lib-tk\FixTk.py", line 65,
 in <module> import _tkinter ImportError: DLL load failed: %1 is not a valid Win32 application.
 2012-Jan-04 12:27:21.889374 (M) [python] Finished process 

I searched _tkinter and i found it in Python27/libs as a lib file.

On many sites it says to install tk/tcl or tkinter, but I don't find a separate installation for windows.

Using Windows x86 MSI Installer (2.7) from http://www.python.org/getit/releases/2.7/. In windows 7 64-bit. The python version is 32 bit.

Answer

David Jacka picture David Jacka · Mar 27, 2012

I had a similar problem importing Tkinter on Windows 7 64-bit - seems that the 64-bit library was still in the libs folder from a previous 64-bit python install.

Uninstalling 64-bit python properly and then repairing with the 32-bit installer fixed the problem for me - you don't need to use 64-bit python.