views:

1646

answers:

3

I will confess I'm very new to Python and I don't really know what I'm doing yet. Recently I created a very small Windows application using Python 2.6.2 and wxPython 2.8. And it works great; I'm quite pleased with how well it works normally. By normally I mean when I invoke it directly through the Python interpreter, like this:

> python myapp.py

However, I wanted to go a step further and actually compile this into a standalone executable file. So I followed these instructions from the wxPython wiki which utilize py2exe. At first it gave me errors in the command line, saying MSVCR90.dll was missing. Then I copied MSVCR90.dll to my Python\DLLs folder. That looked at first like it fixed it, since it successfully did what it needed to do. It did finish with a quick warning that there were some DLL files the program depends on and I may or may not need to distribute them.

So I navigated into the dist folder that py2exe had created and tried running my executable. But trying to open it only popped up an error dialog that said:

This application failed to start because MSVCR90.dll was not found.
Re-installing the application may fix this problem.

So I went ahead and copied MSVCR90.dll again into this dist folder. But that didn't do the trick. Then I copied it into the WINDOWS\system32 directory. That didn't do it either. What do I need to do to get this thing to work?

+2  A: 

I believe installing Microsoft C++ Redistributable Package will install the DLL you need correctly.

Sam DeFabbia-Kane
+6  A: 

You can't just copy msvcr*.dll - they need to be set up using the rules for side-by-side assemblies. You can do this by installing the redistributable package as Sam points out, or you can put them alongside your executables as long as you obey the rules.

See the section "Deploying Visual C++ library DLLs as private assemblies" here: How to Deploy using XCopy for details, but basically your application looks like this:

c:\My App\MyApp.exe
c:\My App\Microsoft.VC90.CRT\Microsoft.VC90.CRT.manifest
c:\My App\Microsoft.VC90.CRT\msvcr90.dll

One benefit of this is that non-admin users can use your app (I believe you need to be an admin to install the runtime via the redistributable installer). And there's no need for any installer - you can just copy the files onto a PC and it all works.

RichieHindle
Is that a Vista feature ? I encountered a similar problem (MSVCP71.DLL reported missing when launching a py2exe app) and just putting it in the same directory as the .exe fixed it (at least on XP)
Luper Rouch
@Luper: I believe the new rules came in with msvcr80.
RichieHindle
+1  A: 

This is a duplicate of another question with a more complete discussion:
http://stackoverflow.com/questions/323424

One day StackOverflow might trust me enough to enough to flag this as a duplicate.

resplin
@resplin, generally if you use a comment on the original question rather than an answer, others who *do* have "flag duplicate" rights will notice it and vote to close as a duplicate.
Peter Hansen
This post isn't a duplicate of the other post. The other post relates to an error when running py2exe. This post relates to an error when running an application generated by py2exe.
Jeff