我不能在pycharm上运行蝗虫,它在错误中说

2024-06-23 19:45:09 发布

您现在位置:Python中文网/ 问答频道 /正文

我想就这个错误寻求帮助。仅供参考,我有两个版本的python,它们是Python2.7和3.9,但我使用了3.9来运行蝗虫。已经在环境变量中设置了路径,并在pycharm中设置了python解释器

我是负载测试的新手,我已经寻找了解决方案,但都没有成功。如果你有办法解决这个问题。我非常感谢你的帮助。多谢各位

以下是错误:

    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: Traceback (most recent call last):
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: File "c:\python27\lib\runpy.py", line 
    174, in _run_module_as_main
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr:
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: "__main__", fname, loader, pkg_name)
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: File "c:\python27\lib\runpy.py", line 
    72, in _run_code
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr:
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: exec code in run_globals
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: File 
    "C:\Python27\Scripts\locust.exe\__main__.py", line 9, in <module>
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: File "c:\python27\lib\site- 
    packages\locust\main.py", line 428, in main
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr:
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: docstring, locusts = 
    load_locustfile(locustfile)
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: File "c:\python27\lib\site- 
    packages\locust\main.py", line 397, in load_locustfile
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr:
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: imported = 
     __import_locustfile__(locustfile, path)
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: File "c:\python27\lib\site- 
    packages\locust\main.py", line 371, in __import_locustfile__
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr:
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: imported = 
    imp.load_source(os.path.splitext(locustfile)[0], path)
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: File 
    "C:\Users\PycharmProjects\LoadTest\seq1creation.py", line 8, in <module>
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr:
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: from locust import HttpUser, 
    SequentialTaskSet, constant, task
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: ImportError
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: :
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr: cannot import name HttpUser
    [2021-07-06 17:14:43,209] EFSI20210122/ERROR/stderr:

Tags: runinpyimportmainlibstderrline
1条回答
网友
1楼 · 发布于 2024-06-23 19:45:09

检查你的蝗虫版本(蝗虫-V)

看起来您正在运行一个旧的(0.x)版本,很可能是最后一个支持Python2的版本

可能根本原因是您以某种方式为2.7环境安装了蝗虫

相关问题 更多 >

    热门问题