pythonimagemetadataexifpyexiv2

AttributeError: module 'pyexiv2' has no attribute 'ImageMetadata' | Python 3.7


I've been trying to run the following code:

exif = pyexiv2.ImageMetadata(image_file)
exif.read()

on Python 3.7.0 and it yields an error AttributeError: module 'pyexiv2' has no attribute 'ImageMetadata'

I haven't used pyexiv2 before but the example illustrated here is similar to mine and I presume it works fine. I'm also not sure if pyexiv2 is fully supported for Python 3. Please Advise.

You can find the script I'm working with here


Solution

  • This module uses

    import pyexiv2
    

    but you have to install py3exiv2 instead of pyexiv2 - you can see it in first line of Tutorial


    But it uses some C/C++ code and it needs other modules in C/C++.

    On Linux I had to install

    apt install exiv2
    
    apt install python3-dev
    
    apt install libexiv2-dev
    
    apt install libboost-python-dev
    

    and later

    pip install py3exiv2
    

    (not pyexiv2)

    See Dependences on page Developers

    On Linux I have installed compiler C/C++ - gcc - but you may have to install it on other systems.