plateform info.

Mike Meyer mwm at mired.org
Thu Sep 22 10:00:20 EDT 2005


Maurice LING <mauriceling at acm.org> writes:
> Is there a way of getting the path to the site-packages directory?

>>> import sys
>>> import os
>>> for dir in sys.path:
...   if os.path.split(dir)[-1] == 'site-packages':
...      print dir
... 
/usr/opt/lib/python2.4/site-packages
>>> 

But there's seldom a reason to want this.

> Considering that Mac OSX with Fink installs python libraries in
> /sw/lib/python<version>, Mac OSX itself has python libraries in
> /System/Library/Frameworks/Python.framework/Versions/<version>/lib, etc
> etc...

And darwinportgs puts them in
/Library/Frameworks/Python.framework/Versions/<Version>/lib/...
but includes /opt/local/lib/python2.4/site-packages in sys.path.

    <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list