Systems Status

Announce? RSS Feed RSS

Blog?RSS Feed RSS

Help Topics

Deschutes Facilities

Campus Facilities

User Account Info

Roundcube Mail

Contact Systems

ipv6 ready

Misc

Installing Python Modules

If you are installing a module source distribution using the Distutils, the instructions will tell you to use setup.py.

python setup.py install

This will try to install the module in python's standard location.

  • /Library/Python/2.7/site-packages/ on OSX
  • /usr/local/lib/pythonX.Y/site-packages on other UNIX distributions

If you aren't an administrator you won't have permissions to perform this install. You should instead install in a directory for which you do have write permission; such as your home directory.

python setup.py install --prefix=~/python

This will install into ~/python/lib/python<version>/site-packages. You can check your python version with

python --version

Currently on Linux (ix), this will install into ~/python/lib/python2.7/site-packages. In order for the python interpreter to find your module you need to add this directory to your PYTHONPATH environment variable. In the bash shell you can set that with the export command.

jdash@ix: ~ 292$ python --version
Python 2.7.6
paul@ix: ~ 293$ export PYTHONPATH=~/python/lib/python2.7/site-packages

References

Edited: May 19, 2016, at 02:12 pm
Copyright © 2024, University of Oregon, All rights reserved
Privacy Policy