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 ~/.zshrcand addexport PATH="$(brew --prefix)/opt/python/libexec/bin:$PATH". See this awesome SO answer for details: https://stackoverflow.com/a/51939526/1265167 source ~/.zshrcpython --versionorwhich pythonshould 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 ~/.zshrcandexport PATH="$(python -m site --user-base)/bin:$PATH" source ~/.zshrcpipenvshould now be available
Use pipenv
mkdir -p ~/Projects/Python/locust.io && cd $_(ortake ~/Projects/Python/locust.iofor oh-my-zsh users)pipenv install locust- installs and creates a Pipfile in the local directorypipenv run locust -VORpipenv shellto not have to keep typingpipenv runin 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.pyfrom that shell)