pyenv
Pyenv is a simple tool to manage multiple versions of Python. This tool helps in the following ways according to the official pyenv GitHub README documentation: It sets the global Python version on a per-user basis. It provides support for per-project Python versions.
As a programmer, either employed at a company, freelancer or even as a hobbyist, you usually work on multiple programming projects simultaneously. And most of those projects require different Python versions and depend on other modules like a particular version of numpy, for example. Or, if you created a Python module yourself and want to validate that it runs correctly on different Python versions, you need a way to install several Python versions on your system. And sometimes, you want to take a sneak at the latest Python release candidate but don’t want to ruin your production system.
Enter the following command into your terminal to install all necessary packages:
sudo apt install -y make 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
git clone https://github.com/pyenv/pyenv.git ~/.pyenv |
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init --path)"' >> ~/.bashrc
pyenv install --list
pyenv versions
pyenv global 3.8.12
pyenv local 3.8.12 # Set it as the local version for the current directory # Set it as the global version
Creating Virtual Environments
Install Virtualenv:
pip3 install virtualenv
Create a Virtual Environment
cd path/to/your/odoo/project
virtualenv venv
Activate the Virtual Environment:
source venv/bin/activate
Install Dependencies:
pip3 install -r requirements.txt