An essential aspect of Python is using modules, and the current page is a guide on installing Python modules. There are many different ways to install Python modules. The current page includes only one of them, and some people may have strong opinions over the “right” way to install modules. So, you may want to verify whether a specific approach is needed when installing your modules, such as using virtual environments. Otherwise, the steps below should help you in installing your modules.
Also, you may receive error messages depending on your version of Windows and Python. If this happens, I recommend just Google searching the error message, perhaps with the words, “Installing Python Module”, after the error message. Unfortunately, it is typically too difficult for me to troubleshoot error messages via email when installing Python modules, so I likely won’t be able to help if you email me about the error message. There are TONS of resources online about Python, however, so searching for these would likely be more helpful anyways than emailing me.
Anyways, I hope the guide below is helpful!
To install Python modules, we should first open the Windows Command Prompt. To do so, click on the search icon on your task bar.
Then click on your search box.
And type in “Command Prompt”.
Then click on the Command Prompt icon that pops up.
You should see a window like this. Your text will be different due to versions of Windows and your unique file paths, but it should appear similar.
Now, to install Python modules, we need to figure out where Python is located in our computer. If you know the answer to that, then you can skip the next few steps. Otherwise, be sure to follow all the steps below.
Let’s go to the search bar again by clicking the icon on your task bar.
Now let’s again click on the search box.
But this time, we are going to type in “python”.
Once we do that, we want to right click on the Python icon that appears. You may have a different version number, but it should appear as Python followed by a version number.
Once you right click, a menu will appear.
Now click on “Open file location”.
When we do that, it will likely open where your Python shortcut is located. That is okay.
We now want to right click on the icon with Python followed by our version number. Then we want to click on “Properties”.
This window will tell us where Python is located in the Target window (as seen below). We want to copy-and-paste the file path, but we don’t want to include the python.exe part (again, as seen below). So, highlight all of the file path except for the python.exe part, and then hit CTRL+C. This will copy the appropriate text.
Now let’s go back to the Command Prompt that we opened before. In this window, type in “cd” followed by a space. Then, paste the file path that you just copied by pressing CTRL+V. It should appear something like the window below.
Now, the command prompt knows where Python is located. Now we can install a module by tying, “python -m pip install” followed by the name of the module. If we wanted to install the pandas module, for example, we would type in, “python -m pip install pandas”. This can be seen in the image below.
Lastly, we just want to hit enter.
And it should successfully install your module! Your output will look a little different from mine, because I had already installed some modules. But, the most important part is the last line that should read, “Successfully installed”, followed by the name of your package.
Hopefully, this guide helped you install your module. If not, Google search your error messages, review the steps of the guide above, and/or look at the following link: https://docs.python.org/3/installing/index.html . Python can sometimes be tricky, but anything can be fixed with enough time and effort. I hope that everything worked out well, though, and you can begin using modules in Python!