pythonmacoshomebrewpyexiv2

pyexiv2 not found but already installed with homebrew on Mac OSX El Capitan


I have installed pyexiv2 on OSX El Capitan with homebrew but when trying to use it, it is not found.

$ brew install pyexiv2
Warning: pyexiv2-0.3.2_1 already installed

$ python mapillary_tools-master/python/geotag_from_gpx.py photos file.gpx
Traceback (most recent call last):
  File "/Users/nighto/Downloads/mapillary_tools-master/python/geotag_from_gpx.py", line 6, in <module>
import pyexiv2
ImportError: No module named pyexiv2

Solution

  • Turns out when pyexiv2 was installed, brew had a quite significant output that I missed:

    ==> Caveats
    Python modules have been installed and Homebrew's site-packages is not 
    in your Python sys.path, so you will not be able to import the modules
    this formula installed. If you plan to develop with these modules,
    please run:
      mkdir -p /Users/YOUR_USER/Library/Python/2.7/lib/python/site-packages
      echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/YOUR_USER/Library/Python/2.7/lib/python/site-packages/homebrew.pth
    

    So you just have to run those two commands and it will work fine.