py2exe解决调用第三方库(MySQLdb等)失败并生成单文件的实例
Thursday, August 8. 2019
1,安装
官网下载 或者 pip install py2exe
2,准备脚本
import MySQLdb
import MySQLdb.cursors
import sys
....
3,准备安装脚本
import sys
from distutils.core import setup
import py2exe
includes = ["MySQLdb",]
options = {"py2exe": {"includes": includes,'bundle_files': 1, 'compressed': True}}
setup(
# The first three parameters are not required, if at least a
# 'version' is given, then a versioninfo resource is built from
# them and added to the executables.
# targets to build
console = ["dbExport.py"],
py_modules =['MySQLdb'],
options = options,
zipfile = None,
)
zipfile = None
表示生成单文件,没加的话会生成1.exe和libary.zip
setup.py py2exe
开始生成exe文件
Continue reading "py2exe解决调用第三方库(MySQLdb等)失败并生成单文件的实例"
1,安装
官网下载 或者 pip install py2exe
2,准备脚本
import MySQLdb import MySQLdb.cursors import sys ....
3,准备安装脚本
import sys from distutils.core import setup import py2exe includes = ["MySQLdb",] options = {"py2exe": {"includes": includes,'bundle_files': 1, 'compressed': True}} setup( # The first three parameters are not required, if at least a # 'version' is given, then a versioninfo resource is built from # them and added to the executables. # targets to build console = ["dbExport.py"], py_modules =['MySQLdb'], options = options, zipfile = None, )
zipfile = None
表示生成单文件,没加的话会生成1.exe和libary.zipsetup.py py2exe
开始生成exe文件Continue reading "py2exe解决调用第三方库(MySQLdb等)失败并生成单文件的实例"
(Page 1 of 1, totaling 1 entries | Visit: 9037)