/ mozey.co / blog

python dev ubuntu

March 1, 2016

🔗 How to set up and use a virtual python environment in Ubuntu?

Install virtualenv and wrapper

sudo apt-get install python-pip

sudo pip install virtualenv

sudo pip install virtualenvwrapper

Setup virtual env

mkdir ~/.venvs

vi ~/.profile

export WORKON_HOME=~/.venvs
source /usr/local/bin/virtualenvwrapper.sh

source ~/.profile

Create a virtual env

mkvirtualenv -p /usr/bin/python3.5 test-python3.5

Active / de-active virtual env

workon test

deactivate

🔗 Install any version of python

sudo add-apt-repository ppa:fkrull/deadsnakes

sudo apt-get update

sudo apt-get install python3.5