How to create, activate and deactivate a virtualenv for Python 3.7.3 on Ubuntu 20.04


At first we need to update the packages.

user@tokyo:~$ sudo apt-get update

To then install python3-pip.

user@tokyo:~$ sudo apt-get -y install python3-pip

And with pip3 install virtualenv.

user@tokyo:~$ pip3 install virtualenv

Now a virtual environment can be created.

user@tokyo:~$ python3 -m virtualenv venv

To activate the virtual environment just enter the following command.

user@tokyo:~$ source venv/bin/activate

To deactivate the virtual environment just enter the following command.

(venv) user@tokyo:~$ deactivate

One response to “How to create, activate and deactivate a virtualenv for Python 3.7.3 on Ubuntu 20.04”

Leave a Reply

Your email address will not be published. Required fields are marked *