Setting up Python in Windows 10
Installing Python under Windows 10 is fairly easy as long as you set up your system environment correctly. Here’s your quick guide:
- Visit the official Python download page and grab the Windows installer for the latest version of Python 3.
- Navigate to the folder where you saved the installation file. Right-click the installer and select “Run as Administrator.” Click “Yes” when Windows asks if you want the program to make changes to your computer.
- The next dialog asks whether you want to “Install Now” or “Customize Installation.” First, check the boxes that say “Install launcher for all users” and “Add Python 3.9 to PATH”. Then, choose “Customize Installation.”
- On the next screen, check all boxes under “Optional Features.” Click next.
- Under “Advanced Options,” set the location where you want to install Python. I like to use a location I can easily find, such as:
That will remind me that I’ve installed Python 3.9.
Also under “Advanced Options,” check the following boxes:
- “Install for all users”
- “Associate files with Python”
- “Create shortcuts for installed applications”
- “Add Python to environment variables”
- “Precompile standard library”
- Click through the dialog to finish the installation and exit the installer.
Testing Your Install
Now, to launch the Python interpreter from the command line, you can open a command prompt (Start Menu > Windows System > Command Prompt) and type:
That will load the Python interpreter:
Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>
Because of the settings you chose during the install, you can now run this interpreter — and, more important, a script — from any directory on your system.
exit() and hit Return to exit the interpreter and get back to a C: prompt.
Optional: Set up useful Python packages
Python 3 comes with the package installer pip already in place, which makes it super easy to add useful packages to your Python installation. The syntax is this (replace
package_name_here with the name of a package you want to install):
pip install package_name_here
pip install beautifulsoup4 requests
pip install csvkit
You’re now set to get started using and learning Python under Windows 10. If you’re looking for a guide, start with the Official Python tutorial.
Like What You Read Here?
My book Practical SQL: A Beginner’s Guide to Storytelling with Data from No Starch Press offers a step-by-step guide learning SQL and working with relational databases. Learn how to wrangle the everyday data you encounter to gain meaningful insights.