Skip to content

Instantly share code, notes, and snippets.

@Integralist
Last active June 2, 2023 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Integralist/e70714efb70cb2a19ee494c1f252e977 to your computer and use it in GitHub Desktop.
Save Integralist/e70714efb70cb2a19ee494c1f252e977 to your computer and use it in GitHub Desktop.
[Python3 Virtual Environment with venv] #python #python3 #makefile #venv #virtual environment
python3 --version # Python 3.11.3
ls /opt/homebrew/Cellar/python@3.11
ls /opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages
ls /opt/homebrew/lib/python3.11/site-packages # above is an alias to this
python3 -m pip list
python3 -m venv testing-fastly-py-tls-bulk-cert # actually creates a subfolder you need to work within
cd testing-fastly-py-tls-bulk-cert
source bin/activate
python3 -m pip list
# from here you can create files in this directory
# or maybe you want to create them in another directory and just use the currently active venv
deactivate
dir := foobar
root := $(shell git rev-parse --show-toplevel)
# NOTE:
# activating the venv via `source` doesn't work so we use the . synonym instead.
venv:
@python3 -m venv .venv/rate_control; \
. .venv/$(dir)/bin/activate; \
python3 -m pip install --quiet --upgrade pip; \
python3 -m pip install --quiet -r $(root)/$(dir)/scripts/requirements.txt
purge: venv
@. .venv/$(dir)/bin/activate; \
python3 $(root)/$(dir)/scripts/...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment