Setting up Python in Windows 10
Installing Python under Windows 10 follows a similar script to installs under older versions of the operating system. In fact, this post follows closely on my previous entries about installing Python under Windows 7 and under Windows 8.1. The biggest difference here is that we’re going to work with Python 3 instead of Python 2.
Ready? Here’s your quick guide:
Set up Python on Windows 10
1. Visit the official Python download page and grab the Windows installer for the latest version of Python 3. A couple of notes:
- Python is currently available in two versions — Python 2 and Python 3. For beginners, that can be confusing. In short, Python 3 is where the language is going; Python 2 has a large base of existing users but isn’t developing beyond bug fixes. Read this for more.
- By default, the installer provides the 32-bit version. There’s also a 64-bit version available. I’ve generally stuck with 32-bit for compatibility issues with some older packages, but installing is so easy you can experiment with either.
2. Run the installer. You’ll have two options — choose “Customize Installation.”
3. On the next screen, check all boxes under “Optional Features.” Click next.
4. Next, under “Advanced Options,” set the location where you want to install Python. For ease, I use:
That refers to an installation of 32-bit Python 3.5.
5. Next, set the system’s PATH variable to include directories that include Python components and packages we’ll add later. To do this:
- Open the Control Panel (easy way: right click the Start Menu icon and select Control Panel).
- In the Control Panel, search for Environment; click Edit the System Environment Variables. Then click the Environment Variables button.
- In the User Variables section, we will need to either edit an existing PATH variable or create one. If you are creating one, make PATH the variable name and add the following directories to the variable values section as shown, separated by a semicolon. If you’re editing an existing PATH, the values are presented on separate lines in the edit dialog. Click New and add one directory per line.
6. Now, you can open a command prompt (Start Menu | Windows System | Command Prompt) and type:
That will load the Python interpreter:
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or license for more information. >>>
Because of the settings you included in your PATH variable, you can now run this interpreter — and, more important, a script — from any directory on your system.
Type 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 some_package with a package name you want to install):
pip install some_package
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.