Creating cx_Freeze exe with Numpy for Python

This is a bug in cx_Freeze - it doesn't automatically detect that it should copy the module numpy.lib.format. It's already fixed in the development version, so if you're in a position to try that, it should work.

Otherwise, you'll need to specify that numpy.lib.format needs to be included in your setup.py. The line will look something like this:

options = {"build_exe": {"packages": ["numpy.lib.format"]}},

See also the documentation.


Numpy seems to be a little confusing to cx_Freeze so you need to declare it explicitly. As referenced in the docs

Here is your solution:

   from cx_Freeze import setup, Executable

   build_exe_options = {"packages": ["numpy"]}

   setup(
        name = "Assignment4_5PythonExe",
        version = "0.1",
        description = "Sort Methods",
        options = {"build_exe": build_exe_options},
        executables = [Executable("Assignment4_5.py")]
        )