执行PythonExe时显示'未找到win10toast分布'

2024-05-26 20:45:40 发布

您现在位置:Python中文网/ 问答频道 /正文

执行带有toastnotification的python exe时,将显示找不到win10toast分发

from win10toast import ToastNotifier
toaster = ToastNotifier()
toaster.show_toast("Hello World!!!",
              "Python is 10 seconds awsm!",
              icon_path="custom.ico",
              duration=10)
toaster.show_toast("Hello World!!!",
             "Python is awesome by default!")

Screenshot


Tags: fromimporthelloworldisshowawsmexe
2条回答

我通过切换到plyer库修复了这个问题。最初,它也有类似的问题,但添加特定于平台的导入有助于:

import plyer.platforms.win.notification
from plyer import notification

notification.notify("Title", "Body")

参考文献: https://github.com/kivy/plyer/issues/485

我要面对同样的问题,我已经进口了6个,appdir和包装.要求在我的代码和转换成exe使用cx冻结现在它是为我工作

from win10toast import ToastNotifier
import six
import appdirs
import packaging.requirements

toaster = ToastNotifier()
toaster.show_toast(
    "Testing pyinstaller",
    "Trying to find root cause",
    duration=10, icon_path="python.ico")

注: 我们也可以在Pyinstaller中使用这个包作为隐藏的\u导入,但是我还没有在Pyinstaller中测试过

相关问题 更多 >

    热门问题