Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create Python EXE without MSVCP90.dll

Tags:

python

py2exe

I'm trying to use Py2Exe to take a python program (using wxPython) to a Windows exe but there is an error regarding MSVCP90.dll . After reading py2exe fails to generate an executable on StackOverflow, it says I need to download this file. However, it also says all target users must download this file. This will be a huge inconvenience for my users (mostly corporate clients who will not know how to download the file), so is there a way to package the with the program?

Thanks!

like image 477
Mark Piecis Avatar asked Apr 08 '12 06:04

Mark Piecis


1 Answers

What is MSVCP90.dll

MSVCP90.dll is Multithreaded, dynamic Visual Studio 2008 C Runtime Library. Generally your application should package MSVCP90.dll unless you are sure that the target machine have the matching CRT. You can use any of the packaging software to package the necessary DLLs and your software and distribute it.

Purpose of MSVCP90.dll

You may be wondering why you need this weird dll? Well CRT is nothing new to python. All application that is based on C heavily relies on C library functions. All the implementations of the standard C Library functions like (malloc, strcpy ..) to name a few is implemented in these libraries. There are different kinds and the specific MSDN website have more details on it. enter image description here

Distributing MSVCP90.dll

When distributing CRT, you should understand that depending upon what CRT you have used the version number which is suffixed with the name of the CRT varies. For example MSVCP90.DLL is the CRT from Visual Studio 2008. A single machine can contain multiple CRTs either in the system folder on in application installation path.

If you are planning to package your application, you need to re-verify, which CRT version your application uses. Packaging wrong CRT or using one can cause undesired and undefined effect. Generally speaking the CRT your Python Installation uses, should be the same CRT you should package.

Determining the correct MSVCRT

As there are different CRT builds with different versions, it is difficult to ascertain, which CRT should be packaged. If you have a running application (executable), you can use dependencywalker to determine the correct version. Right click on any of the DLLs and click on properties and it will show you the location from which this DLL is being picked. enter image description here

Packaging your application.

You can try using PyInstaller to package your application. It would be a convenient way to get the DLL into the target machine.

like image 93
Abhijit Avatar answered Oct 10 '22 09:10

Abhijit