py2exe File "numpy\core\multiarray.pyc", line 10, in __load ImportError: DLL load failed:


Windows 7 64-bit

Anaconda 2.7 64-bit

py2exe 64-bit


I converted my python code to .exe using py2exe and file shown below:

from distutils.core import setup
import py2exe

from distutils.filelist import findall
import matplotlib

opts = {"py2exe": {
    "packages" : ['matplotlib'],
    "includes": ['scipy', 'scipy.integrate', 'scipy.special.*','scipy.linalg.*'],
         'dll_excludes': ['libgdk-win32-2.0-0.dll',

      windows = [{'script': ""}], zipfile = None,
      options= opts,
      data_files = matplotlib.get_py2exe_datafiles()

But this gave me some error saying that there was version conflict with two files. So I changed the two files viz. dist/tcl/tcl8.5/init.tcl (in line 19) and dist/tcl/tk8.5/tk.tcl (in line 18). In my case I changed the version from 8.5.15 to 8.5.18. I found the location of the two files by looking at the path specified by the error in error log. Then the .exe worked just fine.


I zipped the dist folder which contains .exe file. Then, I unzipped it on another computer but it is not working there. Following is the error it shows:

Traceback (most recent call last):
  File "", line 5, in <module>
  File "matplotlib\__init__.pyc", line 122, in <module>
  File "matplotlib\cbook.pyc", line 33, in <module>
  File "numpy\__init__.pyc", line 180, in <module>
  File "numpy\add_newdocs.pyc", line 13, in <module>
  File "numpy\lib\__init__.pyc", line 8, in <module>
  File "numpy\lib\type_check.pyc", line 11, in <module>
  File "numpy\core\__init__.pyc", line 14, in <module>
  File "numpy\core\multiarray.pyc", line 12, in <module>
  File "numpy\core\multiarray.pyc", line 10, in __load
ImportError: DLL load failed: The specified module could not be found.

Update: If I install Anaconda Python 2.7 on the system, there is no error. But then, what is the use of py2exe.


I encountered the same issue. The solution has been found on the link below :

In short, two dlls from "C:\Anaconda2\Library\bin" were missing in the "dist" output of py2exe.

Need Your Help

What is the difference between devm_kzalloc() and kzalloc() in linux driver programming

linux-kernel linux-device-driver device-driver

I have found devm_kzalloc() and kzalloc() in device driver programmong. But I don't know when/where to use these functions. Can anyone please specify the importance of these functions and their usage.