Python with Pushover: 没有名为 pushover 的模块

Python with Pushover: No module named pushover

我测试了一个 python 脚本来使用 Pushover 发送任何想法。但是我收到错误 "ImportError: No module named pushover"

我安装的版本:

# pip install python-pushover
Collecting python-pushover
  Using cached https://files.pythonhosted.org/packages/6f/3d/144a0137c749bd152c3ab7f4d3ce8fe1455168dab36c2fcd900d3fab16ad/python-pushover-0.4.tar.gz
Requirement already satisfied: requests>=1.0 in /usr/local/lib/python3.5/dist-packages (from python-pushover) (2.21.0)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in /usr/local/lib/python3.5/dist-packages (from requests>=1.0->python-pushover) (1.24.1)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.5/dist-packages (from requests>=1.0->python-pushover) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.5/dist-packages (from requests>=1.0->python-pushover) (2018.11.29)
Requirement already satisfied: idna<2.9,>=2.5 in /usr/local/lib/python3.5/dist-packages (from requests>=1.0->python-pushover) (2.8)
Installing collected packages: python-pushover
  Running setup.py install for python-pushover ... done
Successfully installed python-pushover-0.4
# python -V
Python 2.7.13
# python3 -V
Python 3.5.3

脚本头:

#!/usr/bin/env python
import pushover

我尝试使用 pip(3) 安装 python-pushover 但没有成功。

就我而言,你应该:

卸载该软件包:

pip uninstall pushover

并安装正确的包:

pip install python-pushover

并且您的代码可以正常工作。

我今天遇到了这个确切的错误。这是由于您的系统中同时存在不同版本的 python。

执行,/usr/bin/python3 如果模块是为 py3 安装的,而在 运行 脚本之前只为 py2 安装了 /usr/bin/python

参考Installed module using pip, not found了解更多。