close

[Solved] AttributeError: module ‘time’ has no attribute ‘clock’

Hello Guys, How are you all? Hope You all Are Fine. Today I am just importing Crypto.PublicKey in my code But I am facing following error AttributeError: module ‘time’ has no attribute ‘clock’ in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How AttributeError: module ‘time’ has no attribute ‘clock’ Error Occurs ?

I am just importing Crypto.PublicKey in my code But I am facing following error.

AttributeError: module 'time' has no attribute 'clock'

How To Solve AttributeError: module ‘time’ has no attribute ‘clock’ Error ?

  1. How To Solve AttributeError: module 'time' has no attribute 'clock' Error ?

    To Solve AttributeError: module 'time' has no attribute 'clock' Error If You are using PyCrypto then PyCrypto is dead so that you need to use PyCryptodome instead of PyCrypto. First of uninstall PyCrypto with this command. pip3 uninstall PyCrypto Just use these command to install PyCryptodome. pip3 install -U PyCryptodome. Second solution is time.clock() has been removed. So that Use below instaed of time.clock(). Use time.perf_counter() OR time.process_time().

  2. AttributeError: module 'time' has no attribute 'clock'

    To Solve AttributeError: module 'time' has no attribute 'clock' Error If You are using PyCrypto then PyCrypto is dead so that you need to use PyCryptodome instead of PyCrypto. First of uninstall PyCrypto with this command. pip3 uninstall PyCrypto Just use these command to install PyCryptodome. pip3 install -U PyCryptodome. Second solution is time.clock() has been removed. So that Use below instaed of time.clock(). Use time.perf_counter() OR time.process_time().

Solution 1: Use PyCryptodome instead of PyCrypto

If You are using PyCrypto then PyCrypto is dead so that you need to use PyCryptodome instead of PyCrypto. First of uninstall PyCrypto with this command.

pip3 uninstall PyCrypto

Just use these command to install PyCryptodome.

pip3 install -U PyCryptodome

Solution 2: time.clock() has been removed

Here time.clock() has been removed. So that Use below instaed of time.clock(). Use

time.perf_counter()

OR

time.process_time()

Solution 3: time.clock replace with time.time

  1. Just Find C:\Users\ssc\anaconda3\envs\pythonProject2\Lib\site-packages\sqlalchemy\util this folder.
  2. select compat.py file and Open.
  3. search for time.clock in compat.py
  4. Then replace time.clock with time.time
  5. and save it.
  6. Now your error should be solved.

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Please Rate Our Solution to Motivate Us For Give Our Best

Leave a Comment