JohannesBuchner / imagehash

A Python Perceptual Image Hashing Module
BSD 2-Clause "Simplified" License
3.14k stars 328 forks source link

AttributeError: module 'imagehash' has no attribute 'average_hash' #192

Closed prescriptionlifeline closed 4 months ago

prescriptionlifeline commented 1 year ago

Here's my code:

from PIL import Image
import imagehash
import sys

hash = imagehash.average_hash(Image.open(sys.argv[1]), 16)
print(hash)

AttributeError: module 'imagehash' has no attribute 'average_hash' is the error I'm getting.

I'm running Python 3.5.3 and ImageHash 4.3.1.

I had it working before but now it's not and I have no idea as to why.

JohannesBuchner commented 1 year ago

try uninstalling and reinstalling imagehash?

imagehash.__file__ can tell you which python file it picks up. Also don't make a file called imagehash.py