我知道如何使用cx_freeze编译CPython文件为exe,但是是否可能使用PyPy编译一个简单程序为exe?
我知道如何使用cx_freeze编译CPython文件为exe,但是是否可能使用PyPy编译一个简单程序为exe?
http://doc.pypy.org/en/latest/getting-started-dev.html#trying-out-the-translator
如果你的程序是一个应用程序并依赖于外部包,你应该首先尝试确保你的程序在pypy上能正常工作 - 并不是所有的外部库都被支持。然后你可以尝试修改targetpypystandalone脚本来加载你的应用程序模块。如果有疑问,可以在pypy-dev邮件列表或irc.freenode.net的#pypy频道上寻求帮助。这是一个 py2exe 的解决方案,可能适合你:compile.py
#!/usr/bin/env python
# Corey Goldberg
from distutils.core import setup
import py2exe
import sys
if len(sys.argv) == 2:
entry_point = sys.argv[1]
sys.argv.pop()
sys.argv.append('py2exe')
sys.argv.append('-q')
else:
print 'usage: compile.py <python_script>\n'
raw_input('press ENTER to exit...')
sys.exit(1)
opts = {
'py2exe': {
'compressed': 1,
'optimize': 2,
'bundle_files': 1
}
}
setup(console=[entry_point], options=opts, zipfile=None)