- install pyenv
- install pyenv-virtualenv plugin
- Use pyenv to manage environment
pyenv install 3.8.10
pyenv virtualenv 3.8.10 example-env-name
pyenv local cognitive-reserve
More about pyenv here https://realpython.com/intro-to-pyenv/
- list packages used inside virtualenc
pip freeze -l > requirements.txt
Install kernel & add it
python3 -m ipykernel install --user --name=example-env-name
upgrade all packages using pip
pip install -r requirements.txt --upgrade
Put this into .zshrc
export PYENV_VIRTUALENV_DISABLE_PROMPT=1
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if which pyenv > /dev/null; then
eval "$(pyenv init --path)" # this only sets up the path stuff
eval "$(pyenv init -)" # this makes pyenv work in the shell
alias pyenv='nocorrect pyenv'
fi
if which pyenv-virtualenv-init > /dev/null; then
eval "$(pyenv virtualenv-init - zsh)"
fi