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 = "guifoo",
version = "0.1",
description = "My GUI application!",
options = {"build_exe": build_exe_options},
executables = [Executable("guifoo.py", base=base)])
pycharm不知道,一般打包的话我用py2exe的
具体下载地址google一下,装好后在项目下建立setup.py,大致内容如下,N多参数可以看DOC
然后在命令行下运行:
>>python setup.py py2exe就会在项目生成dist目录,里面就是你要的文件用cx_Freeze即可,它和py2exe,py2app类似,不过是跨平台的,并且支持python3。 例子:
之后:
即可