how to find site-packages path

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Philippe C. Martin

    #1

    how to find site-packages path

    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

    *************** ************

  • vincent wehren

    #2
    Re: how to find site-packages path

    Philippe C. Martin wrote:[color=blue]
    > 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.[/color]

    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

    [color=blue]
    >
    > Any clue ?
    >
    > Regards,
    >
    > Philippe
    >
    >
    >[/color]

    Comment

    • Michael Hoffman

      #3
      Re: how to find site-packages path

      Philippe C. Martin wrote:
      [color=blue]
      > 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.[/color]

      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

      Comment

      • Eric S. Johansson

        #4
        Re: how to find site-packages path

        Michael Hoffman wrote:[color=blue]
        > Philippe C. Martin wrote:
        >[color=green]
        >> 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.[/color]
        >
        >
        > 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.[/color]

        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

        Comment

        Working...