我正在尝试使用python中的plyer库在Windows中生成通知。当运行python脚本时,它工作正常。但是,当我尝试使用pyinstaller创建可执行文件并运行可执行文件时,我一直收到此错误
Traceback (most recent call last):
File "site-packages\plyer\utils.py", line 96, in _ensure_obj
ModuleNotFoundError: No module named 'plyer.platforms'
Traceback (most recent call last):
File "in_time.py", line 131, in <module>
File "site-packages\plyer\facades\notification.py", line 84, in notify
File "site-packages\plyer\facades\notification.py", line 90, in _notify
NotImplementedError: No usable implementation found!
这是代码段
from plyer import notification
notification.notify(
title='9 hours Completed',
message='You have successfully completed 9hrs for the day',
app_name='In Time App',
app_icon='Time3.ico'
)
答案 0 :(得分:0)
使用pyinstaller创建可执行文件时,请将其添加到命令中:
--hidden-import plyer.platforms.win.notification