Skip to content

Instantly share code, notes, and snippets.

@danieltomasz
Last active June 18, 2021 10:58
Show Gist options
  • Save danieltomasz/f5f3fcfa8e837bae9e8df01068cdc1b5 to your computer and use it in GitHub Desktop.
Save danieltomasz/f5f3fcfa8e837bae9e8df01068cdc1b5 to your computer and use it in GitHub Desktop.

reproducible pipeline with pyenv

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

Optional: Zsh Setup

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment