how to find site-packages path

Discussion in 'Python' started by Philippe C. Martin, Jan 17, 2005.

  1. Hi,

    I am using my own install script for my software and am looking for a
    flawless way to figure out where python, and more specifically
    site-packages is installed.

    Any clue ?

    Regards,

    Philippe



    --
    ***************************
    Philippe C. Martin
    SnakeCard LLC
    www.snakecard.com
    ***************************
    Philippe C. Martin, Jan 17, 2005
    #1
    1. Advertising

  2. Philippe C. Martin wrote:
    > Hi,
    >
    > I am using my own install script for my software and am looking for a
    > flawless way to figure out where python, and more specifically
    > site-packages is installed.


    You can take a look at how this is done in Lib/site.py.

    Look for the bit of code that starts with

    prefixes = [sys.prefix]
    sitedir = None # make sure sitedir is initialized because of later 'del'
    ....

    etc.

    --
    Vincent Wehren


    >
    > Any clue ?
    >
    > Regards,
    >
    > Philippe
    >
    >
    >
    vincent wehren, Jan 17, 2005
    #2
    1. Advertising

  3. Philippe C. Martin wrote:

    > I am using my own install script for my software and am looking for a
    > flawless way to figure out where python, and more specifically
    > site-packages is installed.


    The flawless way would be to use distutils. In fact you shouldn't even
    need your own install script--it should do most of the work for you.
    --
    Michael Hoffman
    Michael Hoffman, Jan 17, 2005
    #3
  4. Michael Hoffman wrote:
    > Philippe C. Martin wrote:
    >
    >> I am using my own install script for my software and am looking for a
    >> flawless way to figure out where python, and more specifically
    >> site-packages is installed.

    >
    >
    > The flawless way would be to use distutils. In fact you shouldn't even
    > need your own install script--it should do most of the work for you.


    can distutils install in any directory? for example, an application
    which has its own modules should be completely isolated from the general
    Python module namespace. how would you make distutils install in a
    completely separate directory hierarchy and not touch any of the
    site-packages directories or files?

    it looked like that was impossible from the documentation which is why I
    wrote my own installer.

    ---eric
    Eric S. Johansson, Jan 18, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul  Smith
    Replies:
    0
    Views:
    718
    Paul Smith
    Nov 18, 2003
  2. Philippe C. Martin
    Replies:
    1
    Views:
    316
    vincent wehren
    Jan 18, 2005
  3. Philippe C. Martin
    Replies:
    1
    Views:
    308
    David Fraser
    Jan 19, 2005
  4. Replies:
    3
    Views:
    1,458
    Steve Holden
    Mar 6, 2005
  5. alf
    Replies:
    1
    Views:
    258
    Fredrik Lundh
    Nov 2, 2006
Loading...

Share This Page