尝试测试工作代码时出现ModuleNotFoundError

时间:2019-03-18 13:15:57

标签: python

我有一个测试模块,该模块从trade_hub.py导入一个类。由于某些原因,尽管trade_hub.py在同一个virtualenv中独立运行良好,但仍引发ModuleNotFoundError。

任何其他模块都没有其他问题。我的ujson模块和其他模块之间唯一明显的区别在于其安装方法;我使用的是.whl而不是pip。

ujson模块由trade_hub.py导入。

我的包裹:

.addArrangedSubview()

这些执行没有错误:

--bot
   --bot
      --trade_hub.py
   --tests
       --test_trade_hub.py

在同一虚拟环境中,会引发错误:

bot\bot>>> trade_hub.py
bot\bot>>> python -c "import ujson as json"

test_trade_hub.py:

bot\tests>>> test_trade_hub.py

import ujson as json
ModuleNotFoundError: No module named 'ujson'

trade_hub.py:

from trade_hub import TradeHub

0 个答案:

没有答案
相关问题