Skip to content

Instantly share code, notes, and snippets.

@0xnu
Last active October 18, 2022 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0xnu/067d06e0fc4e40a800c154b05adce157 to your computer and use it in GitHub Desktop.
Save 0xnu/067d06e0fc4e40a800c154b05adce157 to your computer and use it in GitHub Desktop.
Install Pyenv on Amazon Linux 2
### prerequisites
sudo yum -y update
sudo yum -y install git tmux
sudo yum -y install @development zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel libffi-devel findutils
### install `pyenv`
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
### restart SHELL and install `python`
echo $PATH
echo $(pyenv root)
pyenv install --list
pyenv install 3.10.5
pyenv versions
### install `pyenv virtualenv`
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile
### restart SHELL and virtualenv
pyenv virtualenv 3.10.5 test-3.10.5
pyenv virtualenvs
pyenv local test-3.10.5
pyenv version
cat .python-version #> test-3.10.5
pyenv rehash
python --version #> Python 3.10.5
pip3 list --format=columns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment