Tags

By year

  1. 2019 (1)
  2. 2018 (2)
  3. 2017 (4)
  4. 2015 (9)

Setting up Python virtualenv with virtualenvwrapper on Ubuntu/EC2

Python Snippet

Posted on Jul 11


Installing virtualenvwrapper

There is a package of virtualenvwrapper and can easily be installed with apt-get.

$ sudo apt-get install virtualenvwrapper

To see what files are installed:

$ dpkg -L virtualenvwrapper

The initialization script virtualenvwrapper.sh is placed in /usr/share/virtualenvwrapper/, instead of /usr/local/bin/.

Settings in .bashrc

export WORKON_HOME=$HOME/.virtualenvs
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh 

Making virtualenv

$ mkvirtualenv env1

Installing Packages and Switching Env

$ workon env1 # Not needed if it is right after mkvirtualenv.
(env1)$ pip install networkx
(env1)$ lssitepackages # To see the package is installed.
(env1)$ mkvirtualenv env2 # Switching env to another one.
(env2)$ pip install pygments
(env2)$ lssitepackages

Removing Env

(env2)$ deactivate
$ rmvirtualenv env2

References


2015 My gh-pages