【问题标题】:Trouble running python unit tests with tox - ImportError for module that is already installed使用 tox 运行 python 单元测试时遇到问题 - 已安装模块的 ImportError
【发布时间】:2017-10-20 17:50:27
【问题描述】:

我是 python 新手,正在尝试为这个项目运行单元测试: https://github.com/matrix-org/synapse

我正在从项目的顶层运行 tox。我收到此错误: exceptions.ImportError: 没有名为 pymacaroons 的模块

但是 pymacaroons 已经使用 pip 安装了。据我所知,我只有一个版本的 python。真的被难住了。

【问题讨论】:

  • 你能提供pip list | grep -i "macaroon"的输出吗?
  • 当然。 pymacaroons (0.12.0)

标签: python python-2.7 pip tox matrix-synapse


【解决方案1】:

tox创建自己的虚拟环境并根据tox.ini安装依赖。 pymacaroons 未在 tox.ini 中列出,因此未安装。要安装它,请将pymacaroons 添加到tox.ini[testenv] 部分,键deps)或将-rrequirements.txt 添加到tox.ini 并在requirements.txt 中列出pymacaroons

【讨论】:

    猜你喜欢
    • 2019-02-23
    • 2019-01-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-05
    • 1970-01-01
    • 1970-01-01
    • 2017-05-30
    相关资源
    最近更新 更多