NotImplementedError: No usable implementation found!

两个事情,都与python发送windows消息有关

 

1.python发送windows消息的代码示例:

#script.py
from
plyer import notification notification.notify( title = 'testing', message = 'message', app_icon = None, timeout = 10, )

 

2.当使用上述代码,在python环境下直接执行py文件没有问题,用pyinstaller打包成exe文件后执行却可能会报错,就是报“NotImplementedError: No usable implementation found!”这个错误。

直接使用 pyinstaller -F -w script.py命令,生成的exe文件执行时会报错,但在后面加上--hidden-import plyer.platforms.win.notification就会正常运行了:

pyinstaller -F -w script.py --hidden-import plyer.platforms.win.notification

 

posted @ 2022-06-25 21:44  Levice  阅读(337)  评论(0编辑  收藏  举报