When/how to change python sys.prefix from /usr when site-packages is in /usr/local?
Question: If I'm following <https://docs.python.org/2/library/site.html> correctly, I
need to either move the site-packages directory to /usr/lib/python2.7 or
change sys.prefix to /usr/local.

The former seems wrong. For the latter the options I can find are to edit
site.py directly or to re-install python. Is editing site.py considered too
hacky, or is it a standard-ish thing to do? (ETA: I would think it's a
standard thing to do, as that's what it's for. Guess I'm really asking if
that's the best choice in this instance.)

Or am I overlooking another option?

/usr/lib vs /usr/local/lib:

    
    
    auto@virgo:/etc/apache2$ ls -ld /usr/lib/python2.7/site-packages
    ls: cannot access /usr/lib/python2.7/site-packages: No such file or directory
    
    auto@virgo:/etc/apache2$ ls -ld /usr/local/lib/python2.7/site-packages
    drwxrwsr-x 2 root staff 4096 Aug 29  2013 /usr/local/lib/python2.7/site-packages
    

python sys.prefix:

    
    
    auto@virgo:~$ python
    Python 2.7.3 (default, Apr 10 2013, 05:46:21) 
    [GCC 4.6.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sys
    >>> print sys.prefix
    /usr
    

Thanks!


Answer: create either `sitecustomize.py` or `usercustomize.py` and append to
`site.PREFIXES`

    
    
    import site
    import os
    SITEPKGS = "/usr/local/site-packages"
    site.addsitedir(SITEPKGS)
    site.PREFIXES += ['/usr/local']
    

from [site](https://docs.python.org/2/library/site.html) docs:

> After these path manipulations, an attempt is made to import a module named
> `sitecustomize`, which can perform arbitrary site-specific customizations.
> It is typically created by a system administrator in the site-packages
> directory. If this import fails with an `ImportError` exception, it is
> silently ignored. If Python is started without output streams available, as
> with `pythonw.exe` on Windows (which is used by default to start IDLE),
> attempted output from `sitecustomize` is ignored. Any exception other than
> `ImportError` causes a silent and perhaps mysterious failure of the process.
>
> After this, an attempt is made to import a module named `usercustomize`,
> which can perform arbitrary user-specific customizations, if
> `ENABLE_USER_SITE` is true. This file is intended to be created in the user
> site-packages directory (see below), which is part of `sys.path` unless
> disabled by `-s`. An `ImportError` will be silently ignored.

