DEV Community

Shaikh Al Amin
Shaikh Al Amin

Posted on • Edited on

How to setup Python 3.10 or later, venv and pip setup in Ubuntu

To Install python 3.10 or latest:


sudo apt update 
sudo apt upgrade

Enter fullscreen mode Exit fullscreen mode

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 

Enter fullscreen mode Exit fullscreen mode

Add PPA dependencies:

sudo add-apt-repository ppa:deadsnakes/ppa 
Enter fullscreen mode Exit fullscreen mode

Update the system:

sudo apt update 
Enter fullscreen mode Exit fullscreen mode

Install python 3.10 and venv

sudo apt install -y python3.10 python3.10-venv
Enter fullscreen mode Exit fullscreen mode

To install pip

sudo apt install -y python3.10-pip

Enter fullscreen mode Exit fullscreen mode

To create a virtual env run the below command

python3.10 -m venv venv
Enter fullscreen mode Exit fullscreen mode

To activate virtual env run the below command

source venv/bin/activate
Enter fullscreen mode Exit fullscreen mode

To deactivate just type deactivate

deactivate
Enter fullscreen mode Exit fullscreen mode

Deleting the Python Virtual Environment

rm -rf venv 
Enter fullscreen mode Exit fullscreen mode

To check the installed Python package inside the virtual env run the below command

pip list or pip3 list
Enter fullscreen mode Exit fullscreen mode

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay