【问题标题】:Python with Pushover: No module named pushover带有 Pushover 的 Python:没有名为 pushover 的模块
【发布时间】:2019-05-14 08:27:46
【问题描述】:

我测试了一个 python 脚本来发送带有 Pushover 的 anythink。但我收到错误“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 但没有成功。

【问题讨论】:

  • 建议使用 virtualenv 来避免此类错误

标签: python python-3.x pushover


【解决方案1】:

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

在运行脚本之前,如果为 py3 安装了模块,则为/usr/bin/python3 为 py2 安装/usr/bin/python

更多信息请参考Installed module using pip, not found

【讨论】:

  • 非常感谢
【解决方案2】:

就我而言,你应该:

卸载该软件包:

pip uninstall pushover

并安装正确的软件包:

pip install python-pushover

而且你的代码可以正常工作。

【讨论】:

  • 同样的错误。Traceback(最近一次调用最后一次):文件“./notify_pushover.py”,第 6 行,在 import pushover ImportError: No module named pushover
  • 嗯,让我再检查一下
  • 执行一下,你用的是什么python版本?
  • 我在第一篇文章中写过:Debian Stretch with Python 2.7.13 and Python 3.5.3
猜你喜欢
  • 2016-01-16
  • 2019-07-03
  • 2021-01-27
  • 2018-07-04
  • 2016-05-25
  • 2021-03-22
  • 2017-12-30
  • 2019-06-12
  • 2015-09-17
相关资源
最近更新 更多