繁体   English   中英

Py2exe:执行创建的exe文件时导入错误

[英]Py2exe: Import error when executes created exe file

创建exe文件后,当我执行以下错误时。enchant已安装在我的系统中。 我正在使用蟒蛇。 构建过程运行平稳,没有任何错误。

Traceback (most recent call last):
File "ocropus-rpred.py", line 5, in <module>
File "enchant\__init__.pyo", line 92, in <module>
File "enchant\_enchant.pyo", line 143, in <module>
ImportError: The 'enchant' C library was not found. Please install it 
via   your OS package manager, or use a pre-built binary wheel from PyPI.

我的setup.py文件是

from distutils.core import setup
import py2exe,sys
import enchant
print  sys.setrecursionlimit(10000)
includes = [ "enchant"]

options = {"py2exe": {"optimize": 2,"includes": includes, }}
setup(console=['ocr/ocropus-rpred.py'],
options = options,
)

这是正确的方法吗? 为什么会发生导入错误?

终于我从pyenchant文档本身得到了答案! 要成功打包使用PyEnchant的应用程序,必须在安装函数的“ data_files”参数中明确包含这些辅助文件。 函数enchant.utils.win32_data_files返回可用于此目的的文件列表。 将此添加到设置

   data_files=enchant.utils.win32_data_files()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM