当我尝试在蝗虫中运行我的负载测试时,我导入另一个模块,我导入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'
但我知道我有这个模块
答案 0 :(得分:0)
您需要在PYTHONPATH
您可以将其作为环境设置执行,也可以使用以下命令通过脚本执行:
sys.path.append_relative(relativ_path_to_your_lib)