Skip to content

Instantly share code, notes, and snippets.

@nareshganesan
Last active June 14, 2024 07:34
Show Gist options
  • Save nareshganesan/53781cbe03cf762648e4f23f94583efe to your computer and use it in GitHub Desktop.
Save nareshganesan/53781cbe03cf762648e4f23f94583efe to your computer and use it in GitHub Desktop.
Ubuntu 18.04 install python3 with pip and pyenv - for multiple python versions
# install dependencies
sudo apt install -y make build-essential \
python3 python-pip libpq-dev python3-dev libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl
# pyenv for installing different python versions
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
# export pyenv path for python environments
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
# install pipenv
sudo -H pip install -U pipenv
pip install --user pipenv
# list versions available
pyenv install --list
# list only 3.6 3.7 3.8
pyenv install --list | grep " 3\.[678]"
# installed versions
pyenv versions
# install specific version
pyenv install 3.7.6
# use specifiv version
pyenv global 3.7.6
# uninstall specific version
pyenv uninstall 3.7.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment