Differences between revisions 2 and 3
Revision 2 as of 2007-12-29 04:41:38
Size: 1687
Editor: TFKyle
Revision 3 as of 2008-02-05 05:46:29
Size: 1689
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 10: Line 10:
for more details about installing packages that use distutils see [http://docs.python.org/inst/inst.html]. for more details about installing packages that use distutils see [[http://docs.python.org/inst/inst.html]].

Installing Python Packages

First we'll start with a bit of knowledge on python packages (if you know much about python you can probably skip this), there's a few ways to install typical python packages that use distutils/setuptools so it is available for other python code to use:

  1. install (well, copy) it into the site-packages dir of your python distribution, python setup.py install does this (as well as other things, some setup.py's also compile C code which the python code uses for example)

  2. unix-like systems only: add a symlink in the site-packages dir pointing at the package dir, this is what I do most of the time when hacking on my code in linux (easier to cd to ~/Projects/<projectname> instead of /usr/lib/python2.5/site-packages/<projectname> or doing the sudo python setup.py install dance (even though it's fairly simple) every time I modify it)

  3. Change the PYTHONPATH environment variable to include the directory with your package directory in, it's a : (or ; in windows) separated list of dirs that python package directories are in

for 2 or 3 if the package contains C code you might want to do something similar to python setup.py build_ext --inplace so they can be imported. also there might be additional things installing with python setup.py install does that you'll want to do manually, of course that's different depending on the package

for more details about installing packages that use distutils see http://docs.python.org/inst/inst.html.

Note: this only applies to packages that use distutils or setuptools (most things with setup.py) and for 2 or 3 have the same structure in the source as in what gets installed

InstallingPythonPackages (last edited 2008-02-05 05:46:29 by localhost)