Skip to content

Instantly share code, notes, and snippets.

@iambryancs
Created May 31, 2023 10:31
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save iambryancs/16f05ba46876b36886a9e7c8b36e56b7 to your computer and use it in GitHub Desktop.
Save iambryancs/16f05ba46876b36886a9e7c8b36e56b7 to your computer and use it in GitHub Desktop.
Using Pyenv in WSL Ubuntu 22.04 LTS to install Python 3.8

Using Pyenv in WSL Ubuntu 22.04 LTS to install Python 3.8

Env

  • Windows 10
  • Ubuntu 22.04 WSL
  • zsh

Requirements

  • git

Install pyenv

curl https://pyenv.run | bash
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
source ~/.zshrc

Install deps

sudo apt-get install -y \
  make \
  build-essential \
  libssl-dev \
  zlib1g-dev \
  libbz2-dev \
  libreadline-dev \
  libsqlite3-dev \
  wget \
  curl \
  llvm \
  libncurses5-dev \
  libncursesw5-dev \
  xz-utils \
  tk-dev \
  liblzma-dev

Install Python 3.8

> pyenv install 3.8
pyenv: /home/bryancs/.pyenv/versions/3.8.16 already exists
continue with installation? (y/N) y
Downloading Python-3.8.16.tar.xz...
-> https://www.python.org/ftp/python/3.8.16/Python-3.8.16.tar.xz
Installing Python-3.8.16...
Installed Python-3.8.16 to /home/bryancs/.pyenv/versions/3.8.16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment