Creating cx_Freeze exe with Numpy for Python

前端 未结 3 537
北海茫月
北海茫月 2020-11-28 14:03

Im trying to create a basic exe using cx_Freeze. It works for .py programs that don\'t have numpy but I can\'t get one made correctly with numpy.

*Any ideas on ho

3条回答
  •  萌比男神i
    2020-11-28 14:36

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

提交回复
热议问题