1.下载py2exe程序
2.安装
3.写一段python test.py
import sys
def test():
print "HelloWorld"
if __name == "__main__":
test()
4.再写一段python调用py2exe的程序,exce.py
from distutils.core import setup
import py2exe
setup(console=['test.py'])
5.在当前路径调用cmd.bat里面写cmd.exe
执行cmd.exe,输入命令python exce.py py2exe
即可在当前目录生成一个dist文件夹内有test.exe和其他依赖组件
6.调用test.exe
7.若有引用复写方法的时候
要这么写
from ConfigParser import ConfigParser
class CaseConfigParser(ConfigParser):
def __init__(self):
ConfigParser.__init__(self)
def optionxform(self, optionstr):
return optionstr
import sys
import CaseConfigParser
def modifyDSNodeIp(filename,ip):
new_Data = ""