Adding new packages directly to python path

As an aside:

When installing libraries for python not through pip install, it’s a good idea to note that the “import” command from python imports from the Python/2.x/site-packages directory. For things like homebrew, you can tell Python where to look for the package by creating symlinks.

For example, when I was trying to link OpenCV installed from Homebrew into my Python path:

cd /Library/Python/2.7/site-packages
ln -s /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv.py cv.py
ln -s /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv.py cv.py

-Sophie

Leave a Reply

Your email address will not be published. Required fields are marked *