为什么 pync .notify for mac 不起作用? (python)

why does pync .notify for mac not work? (python)

我正在尝试在 mac 的 python 中发送通知。我已经安装了pync,并使用了以下代码:

from plyer import notification
import pync, time

while True:
    pync.notify("lets do something random!")
    print("Activated!")
    time.sleep(1)

visual studio 代码调试器显示:

Activated!
Activated!
Activated!

但是,没有显示任何通知。我启用了带有横幅和声音的通知。为什么通知不显示?提前致谢!

是的,它适用于 MacOS 12.3.1

确保您收到来自 terminal-notifier 的通知:

系统偏好设置 -> 通知与焦点 -> terminal-notifier 并允许通知

此外,您的 mac 可能禁用了通知,例如您处于“专注”模式