ImportError DLL load failed importing _tkinter
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.
Solution 1:
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.
Solution 2:
Re-install Python.
If this still doesn't work, there is another simple solution:
- Uninstall your current python. Delete
Python27
folder entirely from yourC:
drive. - Download and install the 64-bit version of Python from http://www.python.org/download/.
- Next time do not mix your 32-bit application with 64-bit OS whenever a 64-bit choice for the application is available!
Solution 3:
I was getting this error while trying to use matplotlib in a simple application.
Uninstall Python and remove its folder from your C-Drive. Download and Install 64bit python. Follow this to install pip on your machine. http://www1.cmc.edu/pages/faculty/alee/cs40/penv/installFlaskOnWindows.html This was finally what worked for me
Solution 4:
I had the same issue and was able to uninstall Python 2.7 (using the Windows 7 'uninstall' service) and then reinstall it from here: python-2.7.6.msi
Also, if you're concerned about ensuring 64bit conformance across your python libraries then you may find the following library list site to be a great resource. It has numerous 64bit versions of python libraries.