Weâre finally here!
We need Python before we can start. If you donât have Python installed yet, start by installing Python. Ideally we would like you to install the latest version of Python, however if you already have an earlier version installed that should work too! At a minimum, this tutorial requires Python 3.5.
This section is based on a tutorial by Geek Girls Carrots .
Weâre going to perform a simple experiment to check whether Python is already installed, and if it is, what version is installed.
Open the Terminal application of your choice (if you donât know what the terminal is feel free to ask a mentor) and enter the following command, depending on your operating system:
python3 --version
py --version
If the command returns Python 3.Y.Z
congratulations you have Python installed! Otherwise you will have to install Python on your machine. How to do this will vary depending on your system, see below for instructions on how to do this for some common systems.
First check whether your computer is running a 32-bit version or a 64-bit version of Windows, by pressing the Windows key + Pause/Break key which will open your System info, and look at the âSystem typeâ line. You can download Python for Windows from the website https://www.python.org/downloads/windows/. Click on the âLatest Python 3 Release - Python x.x.xâ link. If your computer is running a 64-bit version of Windows, download the Windows x86-64 executable installer. Otherwise, download the Windows x86 executable installer. After downloading the installer, you should run it (double-click on it) and follow the instructions there.
One thing to watch out for: During the installation you will notice a window marked âSetupâ. Make sure you tick the âAdd Python 3.x to PATHâ checkbox and click on âInstall Nowâ, as shown below.
Microsoft Store
opens up when you run âpythonâ command in terminal, you can install python from the store directly. It will configure python environment for you.In upcoming steps, youâll be using the Windows Command Line (which weâll also tell you about). For now, if you need to type in some commands, go to Start menu â All Programs â Accessories â Command Prompt. You can also hold in the Windows key and press the âRâ-key until the âRunâ window pops up. To open the Command Line, type âcmdâ and press enter in the âRunâ window. (On newer versions of Windows, you might have to search for âCommand Promptâ since itâs sometimes hidden.)
If you are using an older version of Windows (7, Vista, or any older version) and the Python installer fails with an error, you can try either:
Install all Windows Updates and try to install Python again
Or
Install an older version of Python
, e.g., 3.4.4
.
If you install an older version of Python, the installation screen may look a bit different than shown above. Make sure you scroll down to see âAdd python.exe to Pathâ, then click the button on the left and pick âWill be installed on local hard driveâ:
Before you install Python on OS X, you should ensure your Mac settings allow
installing packages that arenât from the App Store.
Go to System Preferences (itâs in the Applications folder), click
âSecurity & Privacy,â and then the âGeneralâ tab.
If your âAllow apps downloaded from:â is set to âMac App Store,â change it
to âMac App Store and identified developers.â
You need to go to the website https://www.python.org/downloads/ and download the latest version of the Python installer:
It is very likely that you already have Python installed out of the box. To check if you have it installed (and which version it is), open a console and type the following command:
$ python3 --version
Python 3.7.3
If you have a different âmicro versionâ of Python installed, e.g. 3.7.0, then you donât have to upgrade. If you donât have Python installed, or if you want a different version, you can install it as follows:
Type this command into your console:
$ sudo apt-get install python3
Use this command in your console:
$ sudo yum install python3
Use this command in your console:
$ sudo dnf install python3
Use this command in your console:
$ sudo zypper install python3
Verify the installation was successful by opening the Terminal application and running the python3
command:
$ python3 --version
Python 3.7.3
If youâre on Windows and you get an error message that python3
wasnât found, try using python
(without the 3
) and check if it still might be a version of Python 3.
If you have any doubts, or if something went wrong and you have no idea what to do next, please ask a mentor!