“蝗虫中没有名为'的模块

时间:2018-05-07 13:44:22

标签: python locust

当我尝试在蝗虫中运行我的负载测试时,我导入另一个模块,我导入pyquery我收到错误消息:

[2018-05-07 16:31:49,744] Mac.local/ERROR/stderr: imported = __import__(os.path.splitext(locustfile)[0])
[2018-05-07 16:31:49,744] Mac.local/ERROR/stderr:
[2018-05-07 16:31:49,744] Mac.local/ERROR/stderr: File "load_tests/web/login/locustfile.py", line 2, in <module>
[2018-05-07 16:31:49,745] Mac.local/ERROR/stderr:
[2018-05-07 16:31:49,745] Mac.local/ERROR/stderr: import pyquery
[2018-05-07 16:31:49,745] Mac.local/ERROR/stderr:
[2018-05-07 16:31:49,745] Mac.local/ERROR/stderr: ModuleNotFoundError
[2018-05-07 16:31:49,745] Mac.local/ERROR/stderr: :
[2018-05-07 16:31:49,745] Mac.local/ERROR/stderr: No module named 'pyquery'

但我知道我有这个模块

1 个答案:

答案 0 :(得分:0)

您需要在PYTHONPATH

中添加lib的路径

您可以将其作为环境设置执行,也可以使用以下命令通过脚本执行:

sys.path.append_relative(relativ_path_to_your_lib)