Tech%2FPython Virtual Environments

Error converting content: marked is not a function

- Source - https://medium.com/swlh/a-guide-to-python-virtual-environments-8af34aa106ac
- Virtual environments are, essentially, path hijackers
- I’ve found that managing packages with Homebrew, installing Python versions with pyenv, and handling venvs with pyenv-virtualenv gives me maximum flexibility with minimal pain.
- You should have a directory for every project, and a virtual environment for every directory. This structure does two important things:
  - It keeps your stuff organized appropriately, which makes it easier to keep projects separate, manage dependencies, and keep out things that shouldn’t be there. (Who likes having to undo git commits?)
  - It lets you create a separate .python-version file for each directory (and therefore for each project), which means pyenv-virtualenv can automatically switch to the appropriate environment for you when you change directories.
- Unlike the manually-managed venvs, pyenv-virtualenv consolidates all your virtual environments in one directory, rather than scattering them throughout your project files. This is really nice, but it means you can’t just name all of them venv. A good mnemonic is to give them the same name as your project, so you remember which things go together.
- *Personal preference:* I name my environments venv-$PROJECT_NAME. That makes them easy to organize and helps maintain compatibility with older .gitignore files that generally assume venv is the name of your virtual environment.
	-