[Tutor] automatically finding site-packages and python2.3 in a
linux machine
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Thu Jan 6 20:24:30 CET 2005
> > I'm working on creating an installer for my program using install
> > shield, and I'd like to know how one can automatically determine if
> > Python 2.3 is installed on a linux machine
Hi Fred,
Sorry about ignoring parts of your question! Unix has default places for
putting binaries like Python. Check the directories '/usr/bin/' and
'/usr/local/bin'. Also, the 'which' command will also tell us where
Python is, if it's in the user's PATH:
###
[dyoo at shoebox dyoo]$ which python
/usr/bin/python
###
> > and where site-packages is located (so that I can install my own files
> > there). For my Windows version I was able to search for the python2.3
> > entry in the windows registry, but I don't know how do the equivalent
> > from linux. Any ideas?
>
> Yes, there are some undocumented functions in the Distutils package that
> you can use to find where 'site-packages' lives.
I'm totally wrong about this. It IS documented. *grin* Here's a link to
the official documentation:
http://www.python.org/doc/dist/module-distutils.sysconfig.html
Sorry about that; I had expected to find it in the Library Reference, but
the Distutils stuff has its own separate documentation.
Best of wishes to you!
More information about the Tutor
mailing list