Creating a Virtual Environment in Python (Ubuntu)

Subscribe to my newsletter and never miss my upcoming articles

Creating a virtual environment is really very easy in Ubuntu

Step 1:-

First, we have to install the virtual environment using the following command:-

sudo apt install python3-venv

Step 2:-

From the previous step, you have installed the virtual environment on the system, now you have to create a project using it:-

python3 -m venv new-project

Step 3:-

Now for activating the above virtual environment you just have to use:-

source new-project/bin/activate

You will see the following output:-

$ source new-project/bin/activate
(my-project-env) $

Now just install whatever dependencies you want to install like any other library and work on the project.

Happy Coding!

No Comments Yet