Pyinstaller隐藏另一个文件夹中的PIL模块
我跟随我的pyinstaller汇编中的文件,从108个文件/文件夹到6。图像,我也很想隐藏该文件夹。
我已经尝试将其添加到sys.path
在我的钩子中,将导入更改为from lt; fordernamehere> .pil import Import Import Image Image
,然后在之前设置OS.Chdir在进口之后,但什么都没有起作用。错误始终是相同的:
Importerror:无法从'pil'(< pathtobasefolder> \ pil \ pil \ __ init __ init __. pyc)
要注意的一件重要的事情是,我不导入pil PIL立即地。当用户执行特定操作时,它仅在启动后才导入,因为它没有其他目的。我不确定会影响事物有多大的影响。
这可能吗?也许可以使用Ementlib,或者编辑Pyinstaller的本地钩子会起作用?
I followed this post to hide the vast majority of the files in my PyInstaller compilation, going from 108 files/folders to just 6. But one of those 6 is the PIL folder, since you have to do a from-import on it to access Image
, and I would love to hide that folder as well.
I've experimented with adding it to sys.path
in my hook, changing my imports to from <foldernamehere>.PIL import Image
, and setting os.chdir immediately before and after the import but nothing has worked. The error is always the same:
ImportError: cannot import name '_imaging' from 'PIL' (<pathtobasefolder>\PIL\__init__.pyc)
One important thing to note is that I do not import PIL immediately. It's only imported after launch when the user performs specific actions, since it serves no purpose otherwise. I'm not sure how much that affects things.
Is this possible? Maybe importlib can be used, or maybe editing PyInstaller's native hooks would work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用以下命令:pip install -u枕头
Use the following command : pip install -U Pillow