在尝试运行创建的可执行文件时,我一直收到此错误。
Traceback (most recent call last):
File "plyer/utils.py", line 93, in _ensure_obj
ModuleNotFoundError: No module named 'plyer.platforms.macosx'
Traceback (most recent call last):
File "notifs.py", line 9, in <module>
File "plyer/facades/notification.py", line 79, in notify
File "plyer/facades/notification.py", line 88, in _notify
NotImplementedError: No usable implementation found!
[1227] Failed to execute script 'notifs' due to unhandled exception!
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]尝试使用此pyinstaller命令时
pyinstaller --onefile --hidden-import plyer.platforms.linux.notification notifs.py 即使在通知is中更改之后,也会发生这种情况。规格文件
hiddenimports=['plyer.platforms.linux.notification'], 作为参考,这是我的整个代码块。
#!/usr/bin/env python
import time
from plyer import notification
if __name__=="__main__":
notification.notify(
title = "hi",
message="hello Vasundhara" ,
# displaying time
timeout=2
)
# waiting time
time.sleep(7)谢谢你的帮助。
发布于 2022-10-31 04:03:47
根据错误消息,您是否尝试导入"plyer.platforms.macosx.notification“隐藏导入?
如下文所述:
ModuleNotFoundError: No module named 'plyer.platforms.macosx'
错误信息不是请求linux导入,这似乎是您试图修复的,而是请求macosx。
尝试运行:pyinstaller --onefile --hidden-import plyer.platforms.macosx.notification notifs.py
我不确定这是否有效,因为我个人没有mac来测试这一点,但我希望这会有所帮助。
https://stackoverflow.com/questions/72333771
复制相似问题