NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

Creating and Using a Virtual Python Environment

Some terminology if you get lost:

ez_setup.py
A Python module which installs the setuptools package and the ez_install executable.
ez_install
An executable in your Python's bin directory which can automatically install Python packages.
setuptools
A Python package which facilitates creating and distributing third party Python packages.
distutils
A Python package which is the predecessor of setuptools still in wide use.
setup.py
A Python module which, when placed at the top level of a Python package, tells setuptools or distutils how to install the package. It normally consists of one function call (setup()) with numerous arguments. setup.py is defined by the package author.
Pypi
The Python Package Index (aka "Cheeseshop"). A master repository of third party Python packages. ez_install downloads packages from Pypi by default. Pypi contains packages in both "egg" form created by setuptools and zipped packages created by distutils.
egg
A zipped file created by setuptools which contains a distributable form of a Python package.
site-packages
A subdirectory in your Python's lib directory which contains your installed third party Python packages.

There are three places to start:

  • If you don't yet have a Python compiled separately from your system Python,
  • If you have a Python instance separate from your system Python, but it doesn't yet have the setuptools package installed, or
  • If you already have a separated compiled Python with the setuptools package installed.

If you don't yet have a Python compiled separately from your system Python

  • XXX
  • Proceed to:

If you have a Python instance separate from your system Python, but it doesn't yet have the setuptools module installed

  • Get the latest version of ez_setup.py (Right click to save as python file)
  • Run ez_setup.py with your separately compiled Python: /usr/local/python2.6/bin/python ez_setup.py
  • Your separately compiled Python's bin directory will now contain a new executable called ez_install
  • Proceed to:

If you already have a separated compiled Python with the setuptools module installed

  • Install virtualenv with ez_install: /usr/local/python2.6/bin/ez_install virtualenv
  • Your separately compiled Python's bin directory will now contain a new executable called virtualenv