I'm trying to use md5 in python3 using the attached code

from  hashlib import md5 
password = 'pa$$w0rd'
h = hashlib.md5()


put it gives me this error (cannot import name 'md5')

and when i try to import hashlib only it gives this error (module 'hashlib' has no attribute 'md5')

I searched everywhere but i cant find any solution to my case

You may be shadowing the standard lib's hashlib module with another module with the same name. Try

import hashlib

it produces the below output but how this can help me

<module 'hashlib' from 'C:\Users\hohait\Desktop\hashlib.py'>
<module 'hashlib' from 'C:\Users\hohait\Desktop\hashlib.py'>

This file is not the file hashlib.py from the python's standard library. You could rename it (for example myhashlib.py). Make sure that there are no hashlib.pyc or hashlib.pyw in the Desktop folder

Thank you very much man i have spend 7 hours trying to figure out whats wrong
you really helped me thank you again