I ran into Python installation issues enough times to feel like writing about it, hopefully so someone else can solve theirs.
One issue that comes up pretty frequently when you have multiple versions of Python on one computer is the following:
You type “pip install” to install a new package:
You get “Requirement already satisfied”, informing you it’s already installed:
And yet when you run your Python code, you get ModuleNotFoundError: No module named [numpy] for example
Here, your command line believes the module is already installed. In this case, it likely is installed, but probably in the “site-packages” folder of the version of Python that’s different from the one you’re running in IDLE. For example, you might be running Python 3.7 in IDLE, but your command line is running Python 3.9, so even if you change directories, your pip install will continue to believe it is installed.
There’s a quick manual fix here: Just copy the files from the directory mentioned by your command line and paste them into wherever IDLE is running from.
First, open your file explorer and navigate to the directory where your command line says the module is already installed. In my case:
Tells me I need to go to the lib\site-packages folder:
Next, to find out where IDLE is running from, go to your .py file, then File -> Path Browser
A bunch of folders under sys.path will appear
Then you want to open another file explorer and navigate to the folder with almost exactly the same directory as the file pointed by your command line, except the version matching your IDLE path browser. For me, this was the highlighted one: Python37–32\lib\site-packages (your version number might differ).
You should now have the two file explorers side by side like this:
Using good old fashioned eyes, you will notice that one of these has more files than the other. Copy those extra files and paste them into the one missing them. To help you copy them all, sort by the date, since installations of packages usually all happen around the same time. Make sure you copy both files and folders installed around that time, since sorting separates files and folders. To be sure, check the online documentation page of the package to make sure you have everything.