Cx_Freeze - Include Modules automatically

瘦欲@ 提交于 2019-12-11 20:20:09

问题


should I include modules that I have used in my .py like os module in code below or its done automatically?and what about exclude?I have used pyqt4 in my .py is it necessary to add its name in this setup.py file?

import sys
from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(  name = "my-app",
        version = "0.9.0",
        description = "Copyright 2013",
        options = {"build_exe": build_exe_options},
        executables = [Executable("my_module.py", base=base)])

回答1:


As the comment says, dependencies are automatically detected, but you sometimes need to fine tune them manually. os and tkinter are just there as examples, you probably don't need them for your project. Generally, anything you've imported can be detected, but if you load plugin libraries some other way, it won't find them, so you need to specify them.

Try freezing it, and see if it fails because anything is missing, then go back and add that to packages.



来源:https://stackoverflow.com/questions/20096977/cx-freeze-include-modules-automatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!