Install python and virtualenv on a mac
Always forget how I usually do this, so making a note.
See: https://docs.python-guide.org/dev/virtualenvs/
Install brew python
brew install python
- Add brewed python to path:
vi ~/.zshrc
and addexport PATH="$(brew --prefix)/opt/python/libexec/bin:$PATH"
. See this awesome SO answer for details: https://stackoverflow.com/a/51939526/1265167 source ~/.zshrc
python --version
orwhich python
should now point to the brewed python
Install pipenv
Decided to go with pipenv
this time rather than the lower level virtualenv
:
pip install --user pipenv
- As instructed, upgrade pip:
python -m pip install --upgrade pip
- Add pipenv to path:
vi ~/.zshrc
andexport PATH="$(python -m site --user-base)/bin:$PATH"
source ~/.zshrc
pipenv
should now be available
Use pipenv
mkdir -p ~/Projects/Python/locust.io && cd $_
(ortake ~/Projects/Python/locust.io
for oh-my-zsh users)pipenv install locust
- installs and creates a Pipfile in the local directorypipenv run locust -V
ORpipenv shell
to not have to keep typingpipenv run
in front of everything (see the starship command line - whoop whoop!)- Create script e.g.
locustfile.py
pipenv run python locustfile.py
(or just plain oldpython locustfile.py
from that shell)