ModuleNotFoundError: No module named 'plyer' in Python

ModuleNotFoundError: No module named 'plyer' in Python

我正在尝试编写一个程序 notify.py(位置:桌面),它使用 plyer 库在 windows 10 上获得通知。我使用 pip install plyer 并使用 vs code 运行 程序,但我收到一条错误消息:

" from plyer import notification
ModuleNotFoundError: No module named 'plyer' " .

这是我的代码:

from plyer import notification
        
title = "Greetings!"
message = "Don't forget to take a break!"
        
notification.notify(title = title, messgae = message, app_icon = None, timeout = 10, toast = False)

plyer不是Python中的内置模块,所以在你的代码中导入它之前,你应该先安装它。

打开一个 集成终端和运行

pip show plyer

检查其位置是否为 \your current interpreter\lib\site-packages。如果是,请重新加载 window,然后错误 ModuleNotFoundError: No module named 'plyer' 应该会消失。如果没有,请重新安装。