Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

py2exe including MSVC DLLs in the .exe

Tags:

python

dll

py2exe

When using py2exe to distribute Python applications with wxPython, some MSVC DLLs are usually needed to make the .exe work on freshly installed machines. In particular, the two most common DLLs are msvcp71.dll and msvcr71.dll

The former can be included in the .exe using this tip. However, the latter is just placed in the dist dir by py2exe and not into the executable, even if I specifically ask to include it.

Any idea how to cause py2exe to include both inside the .exe ?

like image 524
Eli Bendersky Avatar asked Oct 08 '08 06:10

Eli Bendersky


3 Answers

Wouldn't it fail to launch, then? You want msvcr71.dll in the same directory as the exe, so that the library loader will be able to find and link it into the application's memory map.

It's needed for basic operation, so you can't just let py2exe unpack it with the rest of the DLLs.

like image 181
John Millikin Avatar answered Sep 19 '22 22:09

John Millikin


py2exe can't do this. You can wrap py2exe (there is an example on the wiki showing how to do that with NSIS); you could build your own wrapper if using NSIS or InnoSetup wasn't an option.

Alternatively, if you're positive that your users will have a compatible copy of msvcr71.dll installed (IIRC Vista or XP SP2 users), then you could get away without including it. More usefully, perhaps, if you use Python 2.3 (or older), then Python links against msvcr.dll rather than msvcr71.dll, and any Windows user will have that installed, so you can just not worry about it.

like image 42
Tony Meyer Avatar answered Sep 18 '22 22:09

Tony Meyer


Yes, py2exe can do this. View this link.And if you are using python2.7, replace "msvcr71" to "msvcp90".

like image 34
coordinate Avatar answered Sep 17 '22 22:09

coordinate