How do I install the python multiple version management tool pyenv?
-
Links to pyenv github:
https://github.com/pyenv/pyenv/wiki/common-build-problems
https://github.com/pyenv/pyenv-installer
https://github.com/pyenv/pyenvpyenv - manages multiple versions of python.
Note: One of the main reasons for using this tool is linux has a built-in version of python, which is tightly integrated with the operating system. It is important not to modify this version of python for things like operating system updates. This is not the only benefit of using pyenv.
This article describes how to install pyvenv using the automatic installer on Ubuntu 20.04 LTS.
Make sure you have the ubuntu pre-reqs installed.
sudo apt-get install -y build-essential 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 git
Run the automatic installer script.
$ curl https://pyenv.run | bash
Add the following lines to your .bashrc and restart your shell.
# Environment for pyvenv export PATH="$HOME/.pyenv/bin:$PATH" eval "$(pyenv init -)" eval "$(pyenv virtualenv-init -)"
Test it looks ok.
$ pyenv --version
When you need to update, run the following.
$ pyenv update
If you need to remove the pyenv environment.
$ rm -rf /home/<user>/.pyenv
Delete the lines from your .bashrc file.
# Environment for pyvenv export PATH="$HOME/.pyenv/bin:$PATH" eval "$(pyenv init -)" eval "$(pyenv virtualenv-init -)"
© Lightnetics 2024