HomeAbout

pyenv

Install using pyenv

# check python installation which python # check python version python -V # capital V python --version # Install pyenv curl https://pyenv.run | bash # Update pyenv pyenv update # view which python versions exist in local machine pyenv versions # list all available versions for installation pyenv install -l pyenv install -l | grep '^ [0-9]' # show cpython versions only # install specified version pyenv install 3.11.11 # set python version using pyenv pyenv global 3.11.11

Virtual Environment

# create a virtual environment pyenv virtualenv 3.10.13 <env-name> # activate virtual environment pyenv activate <env-name> # set local python version in project folder pyenv local <env-name>

Creates .python-version in the project folder.

  • virtualenv is auto-activated when you cd into the folder.

Brew Installation (not recommended)

# Homebrew brew install python ## In `.zshrc`, connect PATH export PATH="$(brew --prefix)/opt/python@3.11/libexec/bin:$PATH" # check python version python --version # command using specific version python3
AboutContact