AttributeError:模块“pyexiv2”没有属性“ImageMetadata”| Python 3.7

2024-09-25 08:28:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直在尝试运行以下代码:

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

在Python3.7.0上,它会产生一个错误AttributeError: module 'pyexiv2' has no attribute 'ImageMetadata'

我以前没有使用过pyexiv2,但是示例here与我的类似,我认为它工作得很好。我也不确定pyexiv2是否完全支持Python 3。 请告知

您可以找到我正在使用的脚本here


Tags: no代码image示例readhere错误attribute
1条回答
网友
1楼 · 发布于 2024-09-25 08:28:50

本模块使用

import pyexiv2

但是您必须安装py3exiv2而不是pyexiv2,您可以在Tutorial的第一行看到它


但是它使用了一些C/C++代码,并且需要C/C++中的其他模块

在Linux上,我必须安装

apt install exiv2

apt install python3-dev

apt install libexiv2-dev

apt install libboost-python-dev

后来

pip install py3exiv2

(不是pyexiv2

见第Developers页的Dependences

在Linux上,我安装了编译器C/C++-gcc,但您可能需要在其他系统上安装它

相关问题 更多 >