|
From: David M. C. <co...@ph...> - 2006-01-25 19:04:27
|
On Jan 25, 2006, at 07:52 , Jose Borreguero wrote:
> My system administrator has told me numpy has to be installed
> under /local , instead of under /usr/lib/pythonx.x/site-packages.
> Can anybody point to me what modifications do I have to make for
> this. ? Also, will other libraries that call numpy work after I
> install ?
> jose
First, to install it under /usr/local, run setup.py like this:
$ python setup.py --prefix=/usr/local
This will put numpy into /usr/local/lib/pythonx.x/site-packages.
Next, check if you can import it. If you can't, it's likely that that
path is not in your sys.path. Probably the easiest way to make it
available for _all_ users is to ask your sysadmin to put a file
called 'usrlocal.pth' in /usr/lib/pythonx.x/site-packages with these
contents
import site; site.addsitedir('/usr/local/lib/pythonx.x')
(hopefully he'd be amiable to adding only one file :) This adds /usr/
local/lib/pythonx.x to the sys.path *and* processes any .pth in it.
You can get fancier and add
import os, site; site.addsitedir(os.path.expanduser('~/lib/pythonx.x'))
which would also look in user directories.
Failing that, you'd set the environment variable PYTHONPATH to
include the right directory. This way, .pth files won't be processed.
You could add a sitecustomize.py with the appropriate 'import site;
site.addsitedir(...)'. The addsitedir is what processes .pth files.
These are all generic instructions, not specific to numpy. numpy
itself doesn't need .pth files, but there are other packages that do
(Numeric, PIL, pygtk, amongst others), so it's handy to have.
--
|>|\/|<
/------------------------------------------------------------------\
|David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/
|co...@ph...
|