python – Cant install time module

python – Cant install time module

The time module is part of Pythons standard library. Its installed along with the rest of Python, and you dont need to (nor can you!) install it with pip.

I can import time in the Python Console

Yes, because its already installed.

but not in my actual code

I dont believe you. Show us the exact error message you get when you try.

I think this is a PyCharm bug. I am using the time module with PyCharm and it complains that time is an unresolved reference, even when I use

import time

at the beginning of my file. However, there is no run-time error when I execute my program, even though PyCharm does not recognise time as a valid module.

python – Cant install time module

Try using time.sleep(secs) that should work fine.

Leave a Reply

Your email address will not be published. Required fields are marked *