我试图使用pyinstaller2.0从使用matplotlib和numpy的python脚本构建一个.exe文件,但一直失败。我试过这个代码 Building python pylab/matplotlib exe using pyinstaller 作为一个简单的参考,我为我完成了构建,但是当我运行exe时,我得到了错误:
Traceback (most recent call last):
File "<string>", line 12, in <module>
File "C:\Compilations\pyinstaller-2.0\PyInstaller\loader\iu.py", line 386, in
importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\Compilations\pyinstaller-2.0\PyInstaller\loader\iu.py", line 480, in
doimport
exec co in mod.__dict__
File "C:\Compilations\pyinstaller-2.0\ptest\build\pyi.win32\ptest\out00-PYZ.py
z\PIL.PpmImagePlugin", line 27, in <module>
LookupError: no codec search functions registered: can't find encoding
这是一个bug,还是我需要修改.spec
文件并以某种方式将matplotlib库链接到pyinstaller?如果是的-谁能给我举个简单的例子吗?
我以前尝试过cx_Freeze
,但似乎一使用matplotlib代码就出现了问题。在
提前谢谢!在
编辑PpmImagePlugin.py并在任何其他导入之前添加“import encodings”(不带引号)。我也有同样的问题,这个问题解决了。来源:http://www.pyinstaller.org/ticket/651
相关问题 更多 >
编程相关推荐