I would like to install some packages into a third-party site-packages
directory (beyond the standard system locations). Is there any way to set this up such that .pth files therein are respected?
Background: I'm using OS X, virtualenv, and homebrew. There are a few packages (notably wxPython in my case) that do not install nicely through pip into virtualenv. In these cases, there are homebrew packages that work in their stead. Homebrew creates a third site-packages folder in /usr/local/lib/python2.7
. I'd like to simply point to this folder and leave the maintenance of all items there under brew
's control. It seems, however, that this is not possible.
- Appending to the path via
$PYTHONPATH
does not load .pth files. (Should Python 2.6 on OS X deal with multiple easy-install.pth files in $PYTHONPATH?) - Python does not allow nesting or recursive use of .pth files. (Nested .pth Files or Loading Extra site-dirs from a Network)
- The wrapper for virtualenv
add2virtualenv
adds some extra smarts to the .pth file beyond simply having the directory listed, but I believe it simply reorders the path list.
I'm certainly not the only one interested in this issue. I'd wager a good number of the generic 'pth files not working' questions and posts online that I've stumbled across are related to this issue. Is there a good solution?