[英]I have already installed pynotify, still getting error no module named pynotify
I have already installed pynotify using : 我已经使用以下方法安装了pynotify:
pip install py-notify
When I re-run this it shows : 当我重新运行它时,它显示:
Requirement already satisfied (use --upgrade to upgrade). 要求已经满足(使用--upgrade升级)。
I also tried : 我也尝试过:
pip install --upgrade py-notify
but it shows : 但它显示:
Requirement already up-to-date. 要求已经是最新的。
Below is my simple code to show desktop notification using pynotify. 下面是我使用pynotify显示桌面通知的简单代码。
import pynotify
pynotify.init("Basic")
n = pynotify.Notification("Title", "Some sample content")
n.show()
What should I do now to run below code correctly? 我现在该怎么做才能正确运行代码?
If you need to send GTK balloons - you've not installed correct library. 如果您需要发送GTK气球 - 您没有安装正确的库。
If you want to use "Observer programming pattern" (callback management) - you are using incorrect syntax. 如果要使用“Observer编程模式”(回调管理) - 您使用的语法不正确。
There are two similar packages: 有两个类似的包:
http://www.pygtk.org/
) to work. 需要PyGTK( http://www.pygtk.org/
)才能工作。 Can't be installed from pip
. 无法从pip
安装。 Usually installed with some OS package (something like python-pynotify
). 通常安装一些OS包(类似于python-pynotify
)。 Usage: import pygtk;pygtk.require('2.0');import pynotify
. 用法: import pygtk;pygtk.require('2.0');import pynotify
。 https://pypi.python.org/pypi/notify2
) - alternative wrapper for libnotify. notify2( https://pypi.python.org/pypi/notify2
) - libnotify的替代包装器。 Can be installed from pip
. 可以从pip
安装。 Usage: import notify2
用法: import notify2
There are also two unrelated packages with similar names: 还有两个名称相似的不相关的包:
https://pypi.python.org/pypi/pyinotify
) - wrapper for lib i notify that allows to monitor filesystem changes. pyinotify( https://pypi.python.org/pypi/pyinotify
) - lib i包装器通知允许监视文件系统更改。 Usage: import pyinotify
. 用法: import pyinotify
。 https://pypi.python.org/pypi/py-notify
) - python-only library that implements hooks (callback) storage, calling and filtering with no connections to outside world (third-party libraries or standards). py-notify( https://pypi.python.org/pypi/py-notify
) - 实现钩子(回调)存储,调用和过滤而不与外界连接的第三方库(第三方库或标准)的python-only库。 Usage: import notify
. 用法: import notify
。 faced same problem on Ubuntu 16.04 在Ubuntu 16.04上面临同样的问题
sudo apt-get install python-notify
worked for me 为我工作
There's a names conflict with pynotify
. 与pynotify
存在名称冲突。
I had installed pynotify from PIP using: 我使用PIP从PIP安装了pynotify:
sudo pip install pynotify
Since that was the wrong choice, I removed it with: 由于这是错误的选择,我删除它:
sudo pip uninstall pynotify
And then installed the expected pynotify using: 然后使用以下方法安装预期的pynotify:
sudo apt install python-notify
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.