Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

py2exe throws ImportError: DLL load failed: The specified module could not be found

Tags:

python

py2exe

I cannot seem to get py2exe to work properly. I have run "python setup.py py2exe" in cmd, as well as "python setup.py install"... and When I try to run my executable setup, I get this same error over and over:

enter image description here

After a week I'm starting to get quite frustrated and I'm hoping to be able to resolve the issue today.

I'm using Python 2.7 and py2exe v0.6.9. 64-bit Windows7

like image 594
Skizz Avatar asked Apr 01 '11 14:04

Skizz


3 Answers

FINALLY, I can die a happy man. After agonizing over this problem for over a week, I figured out that the issue is that I had to download the 64bit version of py2exe from SourceForge. The "Get Latest Version" link that they have at the top is for Python 2.5, which is very misleading because I would have assumed it would at least use the latest version of PYTHON that it supports, which I believe is the version I have, Python 2.7.1.

I had to go into the "Browse All Files" section and manually navigate to v0.6.9 and then pick the appropriate version.

I am now able to create an executable from running "C:\Python27\setup.py py2exe".

thanks all for your help/replies.

like image 197
Skizz Avatar answered Nov 12 '22 07:11

Skizz


The most important lines in that error are the last two -

import py2exe_util

ImportError: DLL load failed: The specified module could not be found.

That means py2exe was not installed completely in the first place. Try re-installing it.

like image 3
jhocking Avatar answered Nov 12 '22 08:11

jhocking


You need a version of py2exe that matches the architecture of your python install. If you have a 32bit python install you need a win32 py2exe installer. If you have a x64 python install you need a win64 py2exe installer.

In my case I am on a 64bit machine with a 32bit python install. The Source Forge 'latest' link gave the win64 version of py2exe (because it detected my machine type). But it didn't work, I kept getting the following error:

ImportError: DLL load failed with error code 193

I needed to go back to Source Forge and 'Browse all files' to find the win32 version.

like image 2
Keir Avatar answered Nov 12 '22 07:11

Keir