ImportError: No module named pynotify. While the module is installed

六月ゝ 毕业季﹏ 提交于 2019-12-04 05:08:47
Kalyan Ram

Try this:

pip install py-notify

It worked for me.

You are most likely looking for pyinotify not pynotify. That should fix your ImportError.

Here is the solution for Ubuntu.

First install python-notify: sudo apt-get install python-notify After that you may need to add the right paths:

import sys
sys.path.append('/usr/lib/python2.7/dist-packages/gtk-2.0')
sys.path.append('/usr/lib/python2.7/dist-packages/')

Finally: import pynotify

If what you install is py-notify (http://home.gna.org/py-notify/), it should be:

import notify

Check whether you were using the corresponding pip version for your version of Python. For example, if you have Python2 and Python3 installed, you may have installed pynotify for Python2, and attempting to import it from Python3, which will result in the package not being found.

Try running

pip --version

Assuming pip install is how you installed the package as well as

python --version

to ensure the version numbers are similar.

first check your pipversion and your python running version

pip --version, python --version

if the pip is from python3's packages. and you python environment is running at python2.x. so abandon using your pip to install any notify , you just install python-notify

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!