我使用的是Python 2.7
我正在寻找用我的程序制作.exe的最好方法。我的程序是一个应用程序开发工具,它生成一个.py文件。将此.py文件转换为.exe的最佳方法是什么?
转换将在用户的计算机上进行,他们可能没有安装python。
-Thanks
发布于 2012-10-31 08:38:52
您可以使用py2exe,但前提是计算机上安装了python。如果不安装python,就无法进行转换。
发布于 2012-10-31 08:38:43
最好的方法是在distutils中使用py2exe。这是我在github上的一个项目的sample setup.py:
from distutils.core import setup
import py2exe
from version import version
# This is a GUI app, so I set the windows variable
# I include in with the exe a single data file -- LICENSE.text
# I then set a bunch of options specific to py2exe
setup(windows=[{'script':'mainWindow.py', 'dest_base':'VisPerf'}],
data_files = ['../LICENSE.txt'],
options = {
'py2exe': {
'dist_dir':("../bin/32/%s" % version),
'dll_excludes': [
'MSVCP90.dll'
],
'optimize' : 2
}
})然后从命令行:
C:\YourDirHere\>python setup.py py2exe发布于 2012-10-31 09:56:44
在过去一年左右的时间里,我一直在使用PyInstaller,并且真的开始喜欢上它了。下面我有一些将我从py2exe带到pyinstaller的关键特性
python setup.py install)即可使用。它被设计为从一个目录中调用。python pyinstaller.py -F -o publish -n MyExeName my_handy_script.py https://stackoverflow.com/questions/13149614
复制相似问题