Notes to Self

Alex Sokolsky's Notes on Computers and Programming

Python Virtual Environment

There is more than one way to skin the cat:

Install pyenv+pyenv-virtualenv on MacOS

Install pyenv:

brew update
brew install pyenv
echo 'eval "$(pyenv init --path)"' >> ~/.zprofile
echo 'eval "$(pyenv init -)"' >> ~/.zshrc

Install pyenv-virtualenv:

brew install pyenv-virtualenv
echo 'eval eval "$(pyenv virtualenv-init -)"' >> ~/.zshrc

Install pyenv+pyenv-virtualenv on Linux

curl https://pyenv.run | bash

added this to .zshenv:

# support for pyenv
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Create a Virtual Environment

Virtual Environment Maintenance

To see the current dependencies as a table:

pip3 list

To freeze:

pip3 freeze > requirements.txt