我编写了一个Python应用程序,它使用:
from PIL import Image
我想分发此应用程序的打包版本,以便使用它的任何人都不需要安装所有依赖项 .
为此,我使用了 pyinstaller
,没有太大的成功 . 我跑:
pyinstaller --onefile image_download.py
而且它没有抱怨 . 但是,当我运行应用程序时,我得到:
回溯(最近一次调用最后一次):文件“”,第26行,在文件“/usr/local/lib/python2.7/dist-packages/PyInstaller/loader/pyi_importers.py”,第270行,在load_module exec中(字节码,module.dict)文件“/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(bytecode,module.dict)文件”/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 回答
最后我无法使用
pyinstaller
,因为我无法解决导入问题 .我设法用
Nuitka
和bbfreeze
构建一个独立的可执行文件,所以如果有人遇到同样的问题:值得尝试其他工具 .