我怀疑你的祖母使用 Windows,在这种情况下我建议使用 py2exe。这可能是您所需要的一切...... 1)。创建以下脚本并将其最后一行修改为实际脚本的名称(请参见其最后一行)
#execmaker.py would be the name of this file
#stable version
from distutils.core import setup
import py2exe
includes = []
excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
'Tkconstants', 'Tkinter']
packages = []
dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll',
'tk84.dll']
setup(
options = {"py2exe": {"compressed": 2,
"optimize": 2,
"includes": includes,
"excludes": excludes,
"packages": packages,
"dll_excludes": dll_excludes,
"bundle_files": 3,#dont bundle else unstable
"dist_dir": "dist",
"xref": False,
"skip_archive": False,
"ascii": False,
"custom_boot_script": '',
}
},
windows=['My_Script.py'] #this is the name of your actual script
)
2)。然后您可以通过 cmd 转到此脚本和您的实际脚本所在的目录,然后键入
python execmaker.py py2exe
您现在应该有一个工作可执行文件。现在,您可以双击可执行文件,您的脚本将运行。哦,是的,如果您有任何问题,请按照此人的指示进行操作……他很好!
http://www.blog.pythonlibrary.org/2010/07/31/a-py2exe-tutorial-build-a-binary-series/