Search code examples
pythonpython-3.xdllwindows-7-x64cx-freeze

How to link msvcr100.dll to cx_freeze program


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]


Solution

  • 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)])