使用py2exe将python文件.py编译成能够执行文件.exe

下载py2exe并安装,最新的是py2exe-2.1,只支持python 2.4-2.7
python

编写helloworld.pyide

print("Hello World!")

在py2exe安装目录新建文件setup.py,编写内容以下:命令行

from distutils.core import setup
import py2exe

setup(console=['helloworld.py'])

而后在命令行(cmd)执行:cmd

python setup.py installit

python setup.py py2execonsole

生成的程序在dist文件夹下面。
class

相关文章
相关标签/搜索