Hey, I’ve been having this issue with python where even though it says import colorama at the start of the code, it still comes up with the error no module named colorama. I have tried updating python, uninstalling and reinstalling colorama to the latest version but nothing seems to be working.
colorama isn’t part of the standard distribution. You’ll need to download and install it.
If you’re using Windows, type this in a Command Prompt window:
py -m pip install colorama
Make sure it is being installed to the place Python is looking for it. It can be tricky if you have multiple Python installations or
pip is being called from an old one. Also, if you are using an IDE, it may be creating a virtual environment.
In your Python script, have a look at
sys.path to find out where it looks. Now look there yourself from a file manager: is that where pip is putting
Yeah its in the right directory C:\Users\reaso\AppData\Local\Programs\Python\Python311\Lib\site-packages I did pip show colorama
Okay, and how did you determine that this is the right directory?
What versions of Python are on the computer, and where are they located? (How did you determine this?)
This problem is almost always the result of trying to use a different Python vs. the one where the library was installed. Please read:
I determined it via pip show colorama
Both my pip and Python are on one of the latest versions
On Windows it’s recommended to use the Python Launcher
will list the Python versions that it knows about.
py -m pip show colorama
Does it give the same result as:
pip show colorama
That misses the point. Every installation of Python on the system potentially gets its own Pip. It doesn’t matter right now what version of Pip it is. What matters is which Python it belongs to.
And whether that is the same python that runs the script that behaves surprisingly. So,