Virtual environment (venv) in Python

Working on the machines with no root access is sometimes annoying, especially if you depend on multiple Python packages and your distro is somehow outdated… You may find Python virtual environment (venv) very useful.
First, you need to create venv directory structure (this is done only once):
[bash]
mkdir -p ~/src/venv
cd ~/src/venv
virtualenv py27
[/bash]

Then you can open new BASH terminal and activate your venv by:
[bash]source ~/src/venv/py27/bin/activate[/bash]

After that, you can install / upgrade any packages using pip / easy_install (even including PIP ) ie.
[bash]
pip install –upgrade pip
pip install –upgrade scipy
[/bash]

Insipired by python-guide.

Advertisements

One thought on “Virtual environment (venv) in Python

  1. Pingback: Installing new version of Python without root | BioInfoExpert

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s