python打包exe os模块_python打包成exe格式的方法求教
展開全部
在需要打包的目錄下,新建一py文件setup.py#coding=utf-8
'''
Created?on?2014-11-04
@author:?NeoWu
'''
from?py2exe.build_exe?import?py2exe
from?distutils.core?import?setup
from?glob?import?glob
import?py2exe
import?os,?sys
import?shutil
if?len(sys.argv)?==?1:
sys.argv.append("py2exe")
includes?=?["encodings",?"encodings.*"]
options?=?{"py2exe":
{???"compressed":?1,
"optimize":?2,
"includes":?includes,
"dist_dir":?"bin",
"bundle_files":?1
}
}
setup(
version?=?"1.0",
description?=?u'xxxxx',
name?=?"name",
options?=?options,
zipfile?=?None,
console=[{"script":?"xxxx.py"}],
data_files=[]
)
os.remove("bin//w9xpopen.exe")
shutil.rmtree("build")
cmd到該目錄,62616964757a686964616fe78988e69d8331333335343330運行命令,python setup.py py2exe
總結
以上是生活随笔為你收集整理的python打包exe os模块_python打包成exe格式的方法求教的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python 多个配置文件_django
- 下一篇: 打卡签到python代码_如何利用Pyt