繁体   English   中英

使用 tox 运行 python 单元测试时遇到问题 - 已安装模块的 ImportError

[英]Trouble running python unit tests with tox - ImportError for module that is already installed

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

我正在从项目的顶层运行 tox。 我收到此错误:exceptions.ImportError: No module named pymacaroons

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

tox创建自己的虚拟环境并根据tox.ini安装依赖tox.ini pymacaroons未在tox.ini列出,因此未安装。 要安装它,可以将pymacaroons添加到tox.ini[testenv]节,密钥deps ),或者将-rrequirements.txt添加到tox.inipymacaroonsrequirements.txt列出pymacaroons

如果您的-rrequirements.txt中有tox.ini并在requirements.txt中列出pymacaroons并且您仍然遇到问题,则可能是 tox 没有更新,删除文件夹.tox将强制 tox 更新

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM