Python Virtual Environment Usage
On Radxa OS, installing Python libraries system-wide with pip3 is restricted by the system. You can use a Python virtual environment to isolate project dependencies from the system environment.
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
Install the virtual environment tools
sudo apt install python3-venv
Create a virtual environment
python3 -m venv .venv
Activate the virtual environment
source .venv/bin/activate
Upgrade pip
pip3 install --upgrade pip
Deactivate the virtual environment
deactivate