Custom Python Installation Location

This page is based on custom installation locations, from the PEAK site.

Unix/Linux

  1. Create $HOME/.pydistutils.cfg:
    [install]
    install_lib = ~/.py-site-packages
    install_scripts = ~/bin
    
  2. Create (or extend) the PYTHONPATH environment variable (for (ba)sh):
    export PYTHONPATH=~/.py-site-packages
    
  3. Run setup.py script to fetch and install dependencies
    python setup.py develop
    

Prefix ~/.py-site-packages can be changed to something more suitable for your setup.

Note for Linux users: Make sure you have the python-dev package installed for your Python version, as some code needs to be compiled (those are packages Gaphor depends on, not Gaphor itself).

Note for Ubuntu Linux users: Make sure you have the build-essential package installed. This package installs header files and what more, required to compile the C-extensions of zope.interface.

Windows

The Windows installation is almost the same as for Unix.

Replace yourname with your login name.

  1. Distutils requires a HOME variable where it can find the configuration file. So in your Control Panel -> System -> Advanced -> Environment Variables add the following:
    HOME=C:\Documents and Settings\yourname\Home
    
  1. Create a directory C:\Documents and Settings\yourname\Home. Also create %HOME%\py-site-packages.
  1. Eventually add the Python directory to your PATH (default is C:\Python24)
  1. Create (or extend) PYTHONPATH variable:
    PYTHONPATH=%HOME%\py-site-packages
    
  1. Create a file %HOME%\pydistutils.cfg with the following content:
    [install]
    install_lib=$home\py-site-packages
    install_scripts=$home\bin
    
    [build]
    compiler=mingw32
    

Now you should be able to do python setup.py develop from the command line.

Note that some libraries (e.g zope.interface do not always provide eggs for all python versions. If you run in trouble with a statement like this:

error: Setup script exited with error: command 'gcc' failed: No such file or directory

You should definitely install MinGW from http://mingw.org and add MinGW's bin directory to your path.

For a good Subversion client for Windows have a look at TortoiseSVN.

Mac OS X

Mac OS X is quite simple: place the following in your $HOME/.pydisutils.cfg:

[install]
install_lib = ~/Library/Python/$py_version_short/site-packages
install_scripts = ~/bin