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/", line 13,
 in <module> import Tkinter File "", line 38,
 in <module> import FixTk File "", 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 In windows 7 64-bit. The python version is 32 bit.

Asked By: paduraru2009



Re-install Python.

If this still doesn’t work, there is another simple solution:

  1. Uninstall your current python. Delete Python27 folder entirely from your C: drive.
  2. Download and install the 64-bit version of Python from
  3. Next time do not mix your 32-bit application with 64-bit OS whenever a 64-bit choice for the application is available!
Answered By: Hossein

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.

Answered By: David Jacka

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:

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.

Answered By: user2506472

I have a lot of installed python packages on my machine so I did not want to unistall and reinstall the whole python, I did as follow and the problem was solved:

  1. Change your C:Python27 home folder to another name, for example C:Python27_old

  2. Install a new Python27 on your computer (32 bit)

  3. Copy tcl and DLLs folder from the fresh installed python to the old one (Before this step make a copy of tcl and DLLs of C:Python27_old to recover it if you face any problem in the next steps)

C:Python27tcl Copy and replace to C:Python27_old

C:Python27DLLs Copy and replace to C:Python27_old

  1. Delete the C:Python27
  2. Rename the C:Python27_old to the C:Python27

Please pay attention to get a backup form your tcl and DLLs folder to recover it in case you face any further problem.

SOLVED without reinstalling anything:

1-add these 3 lines to your :

import os
os.environ['TCL_LIBRARY']= r'C:<your python folder>tcltcl8.6'
os.environ['TK_LIBRARY'] = r'C:<your python folder>tcltk8.6'

2- copy tcl86t.dll and tk86t.dll from C:<your python folder>DLLs to <your project folder>(where you have batch file,

3- add "include_files": ["tcl86t.dll", "tk86t.dll"] to option in your, something like:

options= { 'build_exe':{'packages':[.....], "include_files": ["tcl86t.dll", "tk86t.dll"]}},

note: if you didn’t find tcl86t.dll and tk86t.dll in DLLs folder as mentionned in step 2, then try again to search for it,but using research tab in DLLs folder this time.

Answered By: SAADOV

Removing 64 bit python and doing a repair on 32 bit python worked for me. OS: 64 bit Windows Server 2008.

Answered By: Jeremy

I had a similar problem. My Python version was 2.7.12 and 64bit and I was using Windows 10, 64bit OS.
I tried to import Tkinter and what I got back was

ImportError: DLL load failed: %1 is not a valid Win32 application

I uninstalled Python and removed all traces of it. I then installed Python 2.7.14 (32bit) and this seems to have solved my problem. I don’t get this error message any longer.

Answered By: Butterscotch

I also met this issue, because I use 64-bit python. Maybe python 64-bit doesn’t have a good support.

My way is to solve it:

  1. Uninstall python 64-bit.
  2. Install python 32-bit.
  3. Uninstall the 64-bit package. pip uninstall xxx.
  4. Install the 32-bit package. pip install xxx.
Answered By: Raven

For Windows 10,

  1. Uninstall all versions of Python
  2. Install Python 3.x (your latest version) with PATH variable
  3. python -mpip install -U matplotlib
  4. Install Python x.x (your other versions) without PATH variable

Done. Try running your scripts again.

Answered By: Andrew Pankow

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.
This was finally what worked for me

Answered By: Ishani Pandey

Please don’t reinstall Python for this. A simple fix can resolve this issue as below:

  1. Find the matplotlibrc file at Python27Libsite-packagesmatplotlibmpl-datamatplotlibrc
  2. Open using notepad
  3. Change the backend parameter to ‘backend: Qt5Agg’

And it will be solved. No need to reinstall.

Answered By: AbhiGupta

If Python was installed by OsGeo4W then you should also install the python-tcltk and/or python3-tcltk packages in the OsGeo4W setup tool.

Answered By: SzieberthAdam
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.