To Install python 3.10 or latest:
sudo apt update
sudo apt upgrade
Install dependencies
sudo apt install -y software-properties-common build-essential libffi-dev libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev libffi-dev libssl-dev
Add PPA dependencies:
sudo add-apt-repository ppa:deadsnakes/ppa
Update the system:
sudo apt update
Install python 3.10 and venv
sudo apt install -y python3.10 python3.10-venv
To install pip
sudo apt install -y python3.10-pip
To create a virtual env run the below command
python3.10 -m venv venv
To activate virtual env run the below command
source venv/bin/activate
To deactivate just type deactivate
deactivate
Deleting the Python Virtual Environment
rm -rf venv
To check the installed Python package inside the virtual env run the below command
pip list or pip3 list
Top comments (0)