How to set pythonpath in Mac OS X?
Martin Franklin
mfranklin1 at gatwick.westerngeco.slb.com
Fri Oct 24 05:47:01 EDT 2003
On Fri, 2003-10-24 at 10:20, Eric Wichterich wrote:
> Hello Pythonistas,
>
> I am trying to get certain (self-written) libraries imported into my
> scripts using statements like
>
> "from library import function.py".
>
Is this a typo you do not need the .py on the end
it should (perhaps) read:
from library import function
> But they are not being found.
>
> I think that the pythonpath-variable must be expanded to the location
> to this libraries.
>
> But, I can't find any usable information using Google on how to set up
> the pythonpath properly.
> I don't even know where to look for the pythonpath-variable?
>
The pythonpath (or PYTHONPATH) variable is an environment variable -
I'm no MAC expert but I expect there is a command you could use to show
it's value... however from inside a running python program the
PYTHONPATH variable is stored in sys.path and is a list of paths that
python will look in for your module / package.
Python 2.3 (#1, Aug 27 2003, 10:53:10)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/local/lib/python23.zip', '/usr/local/lib/python2.3',
'/usr/local/lib/python2.3/plat-linux2',
'/usr/local/lib/python2.3/lib-tk',
'/usr/local/lib/python2.3/lib-dynload',
'/usr/local/lib/python2.3/site-packages',
'/usr/local/lib/python2.3/site-packages/PIL']
>>>
A quick google on PYTHONPATH should point you towards some useful
information... it is also explained in the (free, online) python
tutorial
http://www.python.org/doc/current/tut/node8.html#SECTION008110000000000000000
> It would be great if anyone could help me out on this?
>
> Thanks,
> Eric
Regards
Martin
--
Martin Franklin <mfranklin1 at gatwick.westerngeco.slb.com>
More information about the Python-list
mailing list