1

我测试了一个 python 脚本来使用 Pushover 发送任何想法。但我收到错误“ImportError:没有名为 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 但没有成功。

4

2 回答 2

0

就我而言,您应该:

卸载该软件包:

pip uninstall pushover

并安装正确的包:

pip install python-pushover

你的代码会正常工作。

于 2018-12-13T06:58:09.513 回答
0

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

如果在运行脚本之前/usr/bin/python3为 py3 和仅为 py2 安装了模块,请执行此操作。/usr/bin/python

请参阅使用 pip 安装的模块,未找到更多信息。

于 2018-12-13T07:33:26.327 回答