简体   繁体   English

Python locust 在 AWS 实例中不起作用

[英]Python locust not working in AWS instances

I am trying to use locust in ec2 instance for load testing of my project.我正在尝试在 ec2 实例中使用 locust 对我的项目进行负载测试。 So, I have installed locust using this command:所以,我已经使用这个命令安装了 locust:

python -m pip install locustio

I got this below response:我得到以下回复:

Requirement already satisfied: locust in /usr/local/lib/python2.7/site-packages (0.0)
Requirement already satisfied: locustio in /usr/local/lib/python2.7/site-packages (from locust) (0.9.0)
Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python2.7/site-packages (from locustio->locust) (1.11.0)
Requirement already satisfied: msgpack>=0.4.2 in /usr/local/lib64/python2.7/site-packages (from locustio->locust) (0.5.6)
Requirement already satisfied: requests>=2.9.1 in /usr/local/lib/python2.7/site-packages (from locustio->locust) (2.19.1)
Requirement already satisfied: gevent>=1.2.2 in /usr/local/lib64/python2.7/site-packages (from locustio->locust) (1.3.6)
Requirement already satisfied: pyzmq>=16.0.2 in /usr/local/lib64/python2.7/site-packages (from locustio->locust) (17.1.2)
Requirement already satisfied: flask>=0.10.1 in /usr/local/lib64/python2.7/site-packages (from locustio->locust) (1.0.2)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python2.7/site-packages (from requests>=2.9.1->locustio->locust) (3.0.4)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in /usr/local/lib/python2.7/site-packages (from requests>=2.9.1->locustio->locust) (1.23)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python2.7/site-packages (from requests>=2.9.1->locustio->locust) (2018.8.24)
Requirement already satisfied: idna<2.8,>=2.5 in /usr/local/lib/python2.7/site-packages (from requests>=2.9.1->locustio->locust) (2.6)
Requirement already satisfied: greenlet>=0.4.14; platform_python_implementation == "CPython" in /usr/local/lib64/python2.7/site-packages (from gevent>=1.2.2->locustio->locust) (0.4.15)
Requirement already satisfied: itsdangerous>=0.24 in /usr/local/lib/python2.7/site-packages (from flask>=0.10.1->locustio->locust) (0.24)
Requirement already satisfied: Jinja2>=2.10 in /usr/local/lib/python2.7/site-packages (from flask>=0.10.1->locustio->locust) (2.10)
Requirement already satisfied: Werkzeug>=0.14 in /usr/local/lib/python2.7/site-packages (from flask>=0.10.1->locustio->locust) (0.14.1)
Requirement already satisfied: click>=5.1 in /usr/local/lib64/python2.7/site-packages (from flask>=0.10.1->locustio->locust) (7.0)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python2.7/site-packages (from Jinja2>=2.10->flask>=0.10.1->locustio->locust) (1.0)

I was thinking, locust is already installed.我在想,locust 已经安装好了。 But when I execute my python script to start the server, it says below:但是当我执行我的 python 脚本来启动服务器时,它说如下:

bash: locust: command not found

Can anyone please help me understand what's going wrong here?任何人都可以帮我理解这里出了什么问题吗? Thanks in advance.提前致谢。

ec2 instances don't necessarily install things in the usual directories. ec2 实例不一定在通常的目录中安装东西。

I'd suggest running a command like:我建议运行如下命令:

find / -name locust 2>/dev/null

This will show you where locust has been installed (possible somewhere like /home/{user}/.local/bin)这将显示 locust 的安装位置(可能在 /home/{user}/.local/bin 之类的地方)

Add this to your path (or whatever directory you found in the command above):将此添加到您的路径(或您在上述命令中找到的任何目录):

export PATH=$PATH:/home/{user}/.local/bin

After that your shell should be able to find the command.之后,您的 shell 应该能够找到该命令。

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

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