简体   繁体   English

我已经安装了pynotify,仍然没有错误,没有名为pynotify的模块

[英]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: 有两个类似的包:

  • pynotify - wrapper for libnotify that shows desktop balloons to notify user about some events. pynotify - libnotify的包装器,显示桌面气球以通知用户某些事件。 Requires PyGTK ( 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
  • notify2 ( 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: 还有两个名称相似的不相关的包:

  • pyinotify ( 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
  • py-notify ( 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.

相关问题 导入错误:没有名为 pynotify 的模块。 安装模块时 - ImportError: No module named pynotify. While the module is installed 如何在 python 中安装 plyer 库? 我已经安装了 plyer 模块,仍然收到“没有模块错误” - how to install plyer library in python? i have already installed plyer module , still am getting "no module error" 我已经安装了 Anaconda 并且我也安装了 pygame,但仍然出现错误 ModuleNotFoundError: No module named 'pygame' - I have installed Anaconda and I have installed pygame as well, but still got an error ModuleNotFoundError: No module named 'pygame' 已经安装了 pyzmq 但仍然出现“ImportError: No module named zmq” - Already installed pyzmq but still getting "ImportError: No module named zmq" 收到错误 ModuleNotFoundError: No module named 'mysql' 当我安装它时 - getting error ModuleNotFoundError: No module named 'mysql' when i have installed it Guake Terminal抛出pynotify属性错误 - Guake Terminal throws pynotify attribute error 在为python 3.4.2安装pynotify模块时找不到vcvarsall.bat错误 - vcvarsall.bat not found error while installing pynotify module for python 3.4.2 安装了virtualenv,但仍然出现“ ModuleNotFoundError:没有名为“ virtualenv”的模块”错误 - Installed virtualenv, but still getting “ModuleNotFoundError: No module named 'virtualenv'” error 我已经安装了 IPython,但仍然“没有名为‘IPython’的模块” - I have installed IPython, and still "No module named 'IPython'" ModuleNotFoundError:没有名为“加密”的模块。 我已经安装了加密但仍然是同样的错误 - ModuleNotFoundError: No module named 'Crypto'. I have installed crypto but still the same error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM