How to install Python’s Virtualenv

Since I made a post about how to install pip, I will show you have to take advantage of it about using a Virtual Environment. The Virtual Environment serves for the purpose of making a project while not changing anything in your system. You can use different versions of Python or packages by using virtualenv.

To install it we will use the command:

pip install virtualenv

To make use of virtualenv:

virtualenv venv

(this last is the name of your virtual environment, you can choose any name)

To activate:

source venv/bin/activate


. venv/bin/activate

To deactivate:

Yes you got it!


If you installed pip with python2 and want to create a virtual environment to work with python3 you’ll have to use the following command:

virtualenv -p python3.x

If virtualenv was installed with Python3:

virtualenv -p python2.x

And there you have it! A configured Virtual Environment.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s