运行pyinstaller app时导入错误

时间:2015-05-13 00:19:58

标签: python pyinstaller pillow

我编写了一个使用以下内容的Python应用程序:

from PIL import Image

我想分发此应用程序的打包版本,以便使用它的任何人都不需要安装所有依赖项。

为此,我使用了pyinstaller,但没有取得多大成功。 我跑:

  

pyinstaller --onefile image_download.py

并没有抱怨。但是,当我运行应用程序时,我得到:

  

追踪(最近一次通话):     文件"",第26行,in     文件" /usr/local/lib/python2.7/dist-packages/PyInstaller/loader/pyi_importers.py",第270行,在load_module中       exec(字节码,模块。字典)     文件" /home/ic/twitter-project/build/image_download/out00-PYZ.pyz/PIL.PngImagePlugin" ;,第40行,在     文件" /usr/local/lib/python2.7/dist-packages/PyInstaller/loader/pyi_importers.py",第270行,在load_module中       exec(字节码,模块。字典)     文件" /home/ic/twitter-project/build/image_download/out00-PYZ.pyz/PIL.Image" ;,第63行,在   ImportError:无法导入名称_imaging

我正在使用:

  • Ubuntu 14.04
  • Python 2.7
  • pyinstaller 2.1
  • PIL.VERSION 1.1.7(虽然我以为我已经安装了Pillow 2.8.1)

该脚本可以正常运行python image_download.py,但由于某种原因,pyinstaller无法导入_imaging。

有什么建议吗?

1 个答案:

答案 0 :(得分:2)

最后我无法使用pyinstaller,因为我无法解决导入问题。

我设法用Nuitkabbfreeze构建一个独立的可执行文件,所以如果有人遇到同样的问题:值得尝试其他工具。