Tested with Ubuntu 22.04
Link command python
to python3
, or pyenv will not be able to detect system version.
sudo ln -s /usr/bin/python3 /usr/bin/python
pyenv manages the different python versions
# dependencies (https://github.com/pyenv/pyenv/wiki#suggested-build-environment)
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
# pyenv installer
curl https://pyenv.run | bash
pyenv update
Put at the bottom of ~/.zshrc
# pyenv (must put at the end)
export PATH="/home/ruth/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"
pyenv install 3.8.14
If for graph-tools or third party tools that require support for shared libraries:
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.8.14
On system python
sudo apt install python3-pip python3-venv
You can check available python versions with pyenv versions
.
pyenv global 3.8.14
python -m venv ~/.venvs/py_onto_36
Make sure you are in system python
pyenv global system
pip3 install virtualenvwrapper
Add the following in ~/.zshrc
or ~/.bashrc
, where WORKON_HOME
is the virtual environments home and VIRTUALENVWRAPPER_PYTHON
is the system python
# venv
export WORKON_HOME=$HOME/.venvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/$(system python version)
source ~/.local/bin/virtualenvwrapper.sh
Update to get the latest pythons
pyenv update