Accessing files installed with distutils

timothy.williams at timothy.williams at
Tue Mar 8 14:32:56 CET 2005

I was wondering how to do this too. I'm trying to write a distutils script that has some data I'd like to include.  From the
distutils docs I get

data_files specifies a sequence of (directory, files) pairs in the
following way:

      data_files=[('bitmaps', ['bm/b1.gif', 'bm/b2.gif']),
                  ('config', ['cfg/data.cfg']),
                  ('/etc/init.d', ['init-script'])]

I can use sys.prefix to find the top level where python is installed,
but this doesn't tell me specifically where site-packages is. On my
Linux box it is in


but on Windows, it's in


Do I need to use sys.platform (along with sys.version) to check what
type of machine I'm on, or is there some better  method to get the
location of site-packages?


More information about the Python-list mailing list