AttributeError: module 'ImageHash' has no attribute 'average_hash'
KonstantinMastak opened this issue · 2 comments
I tried to install the library using:
pip install ImageHash
Then I try something like:
from PIL import Image
import ImageHash
def main():
hash = ImageHash.average_hash(Image.open('D:\test.png'))
print(hash)
if name == 'main':
main()
The first problem was that Python 3.8 (Windows) doesn't find ImageHash library at all. I went to
C:\Program Files (x86)\Python38-32\Lib\site-packages and see folder ImageHash-4.2.0.dist-info and separate file imagehash.py. However all other libraries in that folder also have a subflolder without version in their names, so I created folder C:\Program Files (x86)\Python38-32\Lib\site-packages\ImageHash and copied imagehash.py file there.
After that the error message changed. Now Python sees ImageHash library but shows this error:
AttributeError: module 'ImageHash' has no attribute 'average_hash'
Any ideas on how to solve it? Thanks for advance!
BTW, the whole folder C:\Program Files (x86)\Python38-32\ in in my PATH variables.
The library is called imagehash, not ImageHash.