【发布时间】:2015-08-05 13:40:54
【问题描述】:
我在尝试使用pyinstaller 创建可执行文件时收到一条警告消息。安装Pillow 后出现此警告。以前我从来没有收到任何警告并且能够通过。
pyinstaller 得到的警告是:
7314 INFO: Analyzing main.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyInstaller-2.1.1dev_-py2.7.egg/PyInstaller/hooks/hook-PIL.Image.py:14: RuntimeWarning: Parent module 'PyInstaller.hooks.hook-PIL' not found while handling absolute import
from PyInstaller.hooks.shared_PIL_Image import *
此外,当我尝试运行位于 pyinstaller (dist/main/main) 创建的 dist 文件夹中的代码的可执行文件的 exe/consol 版本时,会显示这些。..
Traceback (most recent call last):
File "<string>", line 26, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyInstaller-2.1.1dev_-py2.7.egg/PyInstaller/loader/pyi_importers.py", line 276, in load_module
exec(bytecode, module.__dict__)
File "/Users/..../build/main/out00-PYZ.pyz/PIL.PngImagePlugin", line 40, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyInstaller-2.1.1dev_-py2.7.egg/PyInstaller/loader/pyi_importers.py", line 276, in load_module
exec(bytecode, module.__dict__)
File "/Users/..../build/main/out00-PYZ.pyz/PIL.Image", line 53, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyInstaller-2.1.1dev_-py2.7.egg/PyInstaller/loader/pyi_importers.py", line 276, in load_module
exec(bytecode, module.__dict__)
File "/Users/..../build/main/out00-PYZ.pyz/FixTk", line 74, in <module>
OSError: [Errno 20] Not a directory: '/Users/.../dist/main/tcl'
logout
[Process completed]
所以,我尝试卸载pillow,安装tk tcl dev 版本。然后安装pillow。即使这样也没有帮助。
我也尝试重新安装pyinstaller,。也没有用
更新 1:
Pyinstaller/hooks 目录中似乎缺少 Pyinstaller.hooks.hook-PIL.py 文件。它在所有平台(Mac、windows 和 linux)上都丢失了。这是我在 Windows 上收到的警告/错误消息,与我在 mac 和 linux 上收到的相同。
后来我找到了一个link,上面写着它的just to need Python import machinery happy。所以我按说的那样创建。然后我在所有平台上都没有得到相同的错误,但是在 mac 上我仍然得到 PILImagePlugin,Image 和 FixTk 错误
【问题讨论】:
标签: python macos tcl pyinstaller pillow