Skip to content

Instantly share code, notes, and snippets.

@SerhatTeker
Last active January 6, 2019 13:21
Show Gist options
  • Save SerhatTeker/1aad054e2b745b769fafbbcbd0b4c9e8 to your computer and use it in GitHub Desktop.
Save SerhatTeker/1aad054e2b745b769fafbbcbd0b4c9e8 to your computer and use it in GitHub Desktop.
How to create and use a virtualenv on Ubuntu 16.04-18.04

How to install virtualenv on Ubuntu 18.04

later from 16.04

install pip

install pip3 if you don't have already

$   sudo apt-get install python3-pip

instal virtualenv

$   sudo pip3 install virtualenv

build new virtualenv

$   cd $YOUR_PROJECT_DIRECTORY
$   virtualenv .venv

.venv or any $NAME for your virtualenv

to activate your virtualev

$   source .venv/bin/activate

to deactivate your virtualev

$   deactivate

P.S:

You can also use Python2.7 interpreter for your virtualenv but I would not recommend that since Python 2.7 will not be maintained after January 1, 2020. But if you like to:

$   virtualenv -p /usr/bin/python2.7 venv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment