gpt4 book ai didi

python - 使用pyinstaller创建可执行文件时python的plyer库问题

转载 作者:行者123 更新时间:2023-12-03 11:05:45 25 4
gpt4 key购买 nike

我正在尝试使用 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'
)

最佳答案

使用 pyinstaller 创建可执行文件时,将其添加到命令中:

--hidden-import plyer.platforms.win.notification

关于python - 使用pyinstaller创建可执行文件时python的plyer库问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56281839/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com