How to install 'pyenv' Python version manager on Ubuntu 20.04
·
Overview:
pyenv - is a simple Python version manager tool, which allows you easily switch between multiple versions of Python. You can set local or global system-wide Python versions via the tool.
Installation:
- Install all required prerequisite dependencies:
sudo apt-get update; sudo apt-get install make build-essential libssl-dev zlib1g-dev \ libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \ libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev - Download and execute installation script:
curl https://pyenv.run | bash - Add the following entries into your
~/.bashrcfile:# pyenv export PATH="$HOME/.pyenv/bin:$PATH" eval "$(pyenv init --path)" eval "$(pyenv virtualenv-init -)" - Restart your shell:
exec $SHELL - Validate installation:
pyenv --version
Uninstallation:
- Remove the
~/.pyenvfolderrm -fr ~/.pyenv - Delete the following entries from your
~/.bashrcfile:export PATH="$HOME/.pyenv/bin:$PATH" eval "$(pyenv init --path)" eval "$(pyenv virtualenv-init -)" - Restart your shell
exec $SHELL
Basic commands:
- To install specific version use
installflag:pyenv install 3.8.0 - To list all available installed versions of Python on your system:
pyenv versions - To set a specific version of Python global (system-wide) use
globalflag:pyenv global 3.8.0 - To set a specific version of Python local (project-based) use
localflag:pyenv local 3.8.0
Reference:
- Command reference
- Troubleshooting / FAQ
更多推荐

所有评论(0)