Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

Using mkvirtualenv to create new Virtual Environment – Python

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Virtual Environment are used If you already have a python version installed and you want to use a different version for a project without bothering the older ones. it is good practice to use a new virtual environment for different projects.

There are multiple ways of creating that, today we will create one using mkvirtualenv  command.


To use the  mkvirtualenv command you need to have virtualenvwrapper installed which is nothing but a set of python extension commands.

Make sure you have pip installed.

$ sudo apt-get install python3-pip

Installing virtualenvwrapper 

$ sudo pip3 install virtualenvwrapper

Open bashrc by –

$ sudo gedit ~/.bashrc

After opening it, add the following  lines to it :

export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/

Save the bashrc file.

Using mkvirtualenv command

Now let us use it,

The syntax is :

$ mkvirtualenv venv_name

If you want to work on another version of python, try this :

$ mkvirtualenv -p python3.x venv_name
$(venv_name) // You will see something like this

Note: You can use any version in place of x. 

To work on an existing virtual environment,

$ workon venv_name

To get out of the virtual environment –

$(venv_name) deactivate

To see the list of your virtual environments are, go to-

My Personal Notes arrow_drop_up
Last Updated : 08 Jun, 2020
Like Article
Save Article
Similar Reads
Related Tutorials