py2exe 第三方库 打包
时间:2010-10-27
来源:互联网
我使用到 lxml
#setup.py
from distutils.core import setup
import py2exe
import sets
setup(options={'py2exe': {'bundle_files': 1}},
zipfile=None,
console=['test.py'],)
我下 python setup.py py2exe -p lxml
下面編出來的運行文件
D:\app\dist>test.exe
Traceback (most recent call last):
File "test.py", line 3, in <module>
File "zipextimporter.pyc", line 98, in load_module
File "lxml.etree.pyx", line 48, in lxml.etree (src/lxml/lxml.etree.c:139819)
ImportError: No module named gzip
謝謝
#setup.py
from distutils.core import setup
import py2exe
import sets
setup(options={'py2exe': {'bundle_files': 1}},
zipfile=None,
console=['test.py'],)
我下 python setup.py py2exe -p lxml
下面編出來的運行文件
D:\app\dist>test.exe
Traceback (most recent call last):
File "test.py", line 3, in <module>
File "zipextimporter.pyc", line 98, in load_module
File "lxml.etree.pyx", line 48, in lxml.etree (src/lxml/lxml.etree.c:139819)
ImportError: No module named gzip
謝謝
作者: shihyu 发布时间: 2010-10-27
在你的test.py第三行,引用的模块zipextimporter.pyc
在zipextimporter.pyc的98行引入的lxml.etree.pyx48行
出错,是
ImportError: No module named gzip
没有gzip模块
一般在引入*.pyc模块时,打包不要选打成单一的EXE,这样很容易报错。
"bundle_files": 1,不要设置为1,改为2或3(不打包为单一的EXE)
见下面的例子,可能有些不能用
复制代码
在zipextimporter.pyc的98行引入的lxml.etree.pyx48行
出错,是
ImportError: No module named gzip
没有gzip模块
一般在引入*.pyc模块时,打包不要选打成单一的EXE,这样很容易报错。
"bundle_files": 1,不要设置为1,改为2或3(不打包为单一的EXE)
见下面的例子,可能有些不能用
- from distutils.core import setup
- import py2exe
- import _MyCon
- class Target:
- def __init__(self, **kw):
- self.__dict__.update(kw)
- self.version = _MyCon.version
- self.company_name = _MyCon.company_name
- self.copyright = _MyCon.copyrights
- self.name = _MyCon.name_up
- includes = ["encodings", "encodings.*"]
- dll_excludes = ["w9xpopen.exe","msvcp90.dll"]
- excludes = ["encodings", "encodings.*","win32ui","win32gui","pywin", "pywin.debugger", "pywin.debugger.dbgcon",
- "pywin.dialogs", "pywin.dialogs.list", "win32com.client"]
- options = {
- "bundle_files": 1,
- "ascii": 1,
- "compressed": 1,
- "optimize":2,
- "dll_excludes":dll_excludes,
- "includes": includes
- }
- name_wx=Target(
- script = _MyCon.script_up,
- icon_resources = [(1, _MyCon.icon_up)],
- dest_base = _MyCon.dest_base1
- )
- setup(
- windows = [name_wx],
- options={"py2exe": options},
- zipfile=None,
- )
作者: 我不是老手 发布时间: 2010-10-29
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28