DEV Community

Cover image for Creating a Virtual Environment in Python (Ubuntu)
Sarvesh Dubey
Sarvesh Dubey

Posted on • Originally published at dubesar.hashnode.dev

Creating a Virtual Environment in Python (Ubuntu)

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) $
Enter fullscreen mode Exit fullscreen mode

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

Happy Coding!

Top comments (0)