Skip to content

Instantly share code, notes, and snippets.

@seven62
Last active June 7, 2020 17:46
Show Gist options
  • Save seven62/ea817806f10242630bd634d9737d6fe0 to your computer and use it in GitHub Desktop.
Save seven62/ea817806f10242630bd634d9737d6fe0 to your computer and use it in GitHub Desktop.

Pyenv Lab

This lab is written specifically for issued macbooks.

Step 1 - Installation

  1. Install the Brew package manager if you don't have it:
  • $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  1. Install dependencies:
  • $ brew install openssl readline sqlite3 xz zlib nano
  1. If you're running macOS Mojave or higher, you may need to run:
  • $ sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
  1. Run the pyenv install script:
  • $ curl https://pyenv.run | bash
  1. Update your system's "PATH" to include pyenv by editing your bash profile:

    • nano ~/.bash_profile
    • add the below snippet to the bottom of the file:
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Close and restart your terminal app to read in new changes!


Step 2 - Basic Usage

Run these commands in order to get a better feeling for pyenv!

  1. list available cli options

    • $ pyenv
  2. list packages / versions available

    • $ pyenv install --list
  3. list packages / versions available

    • $ pyenv install --list | grep "3.8.3"
  4. install version 3.8.3

    • $ pyenv install -v 3.8.3
    • list installed versions
    • $ pyenv versions
    • list active version
    • $ pyenv version
    • set new global version
    • $ pyenv global 3.8.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment