Installing Python on Windows
Here’s what you need to do to set up your Windows machine:
- Use this link to download Python.
- Windows may prompt you on whether you want to run or install Python. Click Run or Yes when these prompts may appear. Otherwise, save the file to your computer and double-click to start the installer. If you see this message: “The TARGETDIR variable must be provided when invoking this installer” you may need to right click the installer and run it as an administrator.
- Important! Before pressing the “Install Now” button - Check the box to “Add Python 3.7 to PATH”.
- Click Install Now. This will also install IDLE (official Python IDE), pip (used to install Python packages), and documentation tools that will make your Python learning experience much easier.
- Follow the instructions to complete the installation if prompted also press Disable path length limit and accept the changes. Click Close when complete.
Accessing the Python Interpreter
Now we can make sure Python installed correctly by opening a command prompt and starting the Python interpreter. We will be doing this a few times so be sure to get comfortable with this process.
Open up the start menu and search for and open the “command prompt”. You can also search for “cmd” to find the program.
The command prompt is another way of interacting with your computer. It can do many of the same things like running programs, editing files and more but it does so in a text-based manner.
We will run the Python interpreter and Python scripts from the command prompt. When you successfully open the command prompt, you can
- At the command prompt (which will look something like
C:\Users\username>
, type:py
You should see something that looks like this:
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
You just started Python! The >>>
indicates that you are at a new type of prompt – a Python prompt.
The command prompt (the one starting with C:\
) lets you navigate your computer and run programs, and the Python prompt lets you write and run Python code interactively. Make sure the number that you see following Python is a 3!
- To exit the Python shell, type
exit()
and hit enter. You’ll now be back at the Windows command prompt (theC:\Users\username>
that you saw earlier).