How to install virtualenv in Ubuntu?

Tact Labs
featurepreneur
Published in
Jan 14, 2021
Photo by AltumCode on Unsplash

If you haven’t installed pip, you can install it

sudo apt-get install python3-pip

Install Virtualenv using pip3

sudo pip3 install virtualenv

You can create a virtual environment

virtualenv venv

You can use the specific version

virtualenv --python python3 venv

You can use specific interpreter

virtualenv -p /usr/bin/python2.7 venv

Activate your virtual environment

source venv/bin/activate

How to activate?

deactivate

If you face any issues in Ubuntu, you may need to install

sudo apt-get install build-essential libssl-dev libffi-dev python-dev

Source:
https://gist.github.com/frfahim/73c0fad6350332cef7a653bcd762f08d

--

--