Before we begin programming in Python we need to check if we have python installed to do this use the open the command line and type in:
C:\Users\Your Name>python –version
This should return the version of python you are running. If an error has been thrown that means python has not been installed.
To install Python head over to: https://www.python.org/downloads/ then click the yellow download button at the top of the page. This will download the installer for Python
On the installer make sure you tick the box for “add Python to PATH” this will allow to use python in the command line.
After the installation open the command Line and type in:
C:\Users\Your Name>python
This will return
Python version (Build, Time) [Compiler version] on win32/64 Type "help", "copyright", "credits" or "license" for more information.
Type in “1+1” and hit return this will give the answer “2”
This shows us that Python is working
To exit python in the command line type in:
exit()
If you have the error python is not recognized as an internal or external command we need to add python to PATH
python is not recognized as an internal or external command we need to add python to PATH
Go to:
Control Panel > System and Security > System > Advanced System Settings (On the left hand side)
A small window should open
Select the Advanced tab > Environment Variables (at the bottom) > select Path (on the second box called System variables) > Edit... (button at bottom)
Another window should open
New (button) > type in the location of where your Python has been installed New (button again) > The scripts folder
Python should now work in the command line