7

I have a Console type Python3 program [.py] which when executed [exe file after compiling] gives missing msvcr100.dll error in some machines [friends or relatives etc.] to which I need to download that dll file [google search and download it] and copy it to system32 folder myself.

Hence, after googling I found that cx_Freeze has an option called "include_msvcr" in the build_exe which might help me solve this issue but the documentation was not to my standard and I couldn't understand how to do that.

Here is my setup_console.py code:

import sys
from cx_Freeze import setup, Executable

base=None
if sys.platform=='win32':
    base="Win32GUI"

setup( name="Rescue Unit",
       version="2.0",
       executables=[Executable("resunitv2.py",base)])

I tried adding the include_msvcr line after the base argument in Executable but it gave a include_msvcr not defined error.

Btw. I use this GUI compiling code as I do not want a console window to appear as long as the program is running [hate it] Can anyone show me how to do it [with an example code perhaps]

[cx_Freeze version is 4.3.3, Python version is 3.5, Windows 7 SP1 x64]

3
  • I need to download that dll file and copy it to system32 folder myself. that is not how you are supposed to do this. You have to download the Visual C++ Runtime and install it: microsoft.com/en-us/download/details.aspx?id=5555
    – stijn
    Commented Jun 8, 2014 at 7:51
  • well @stijn even I know that, but my program just depends on that dll alone and beleive me when I say it just needs only that file. I downloaded it, copied it to the system32 folder and have never faced any problems till now Commented Jun 8, 2014 at 8:43
  • I'm not saying your method does not work, I am saying it is not the correct way to distribute the dll since it can cause problems for other applications or your application in the future. Correct way is to either install the redist package or put the dll in your application directory but never in system32. See msdn.microsoft.com/en-us/library/ms235299.aspx and stackoverflow.com/questions/1073509/… for example
    – stijn
    Commented Jun 8, 2014 at 8:54

1 Answer 1

11

Thanks for all the help everyone but I figured it out myself. The include_msvcr option is to be added in the setup.py file as follows:

import sys

from cx_Freeze import setup, Executable

build_exe_options = {
"include_msvcr": True   #skip error msvcr100.dll missing
}

base=None

if sys.platform=='win32':
base="WIN32GUI"


setup(  name = "AppName",
        version = "1.0",
        description = "blah blah",
        options = {"build_exe": build_exe_options},
        executables = [Executable("appname.py", base=base)])
1
  • Thanks, works for me a year later. This was the only dependency from the C++ runtime I needed, saved me from forcing customers to install that too.
    – akagixxer
    Commented May 11, 2015 at 1:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.