CommonLounge Archive

Python3 Installation

May 17, 2018

As a Python developer, you won’t always be able to write your code in the browser on CommonLounge 😊. You will have to set up your computer so that you can run and develop complex Python applications. This section teaches you how to get Python up and running on your own computer!

Python installation

Let’s start by installing Python! We want you to install Python 3.6, so if you have any earlier version, you will need to upgrade it.

Windows

  1. 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.
  2. You can download Python for Windows from the website: Python Release Python 3.6.1.
  3. Scroll to the bottom of the page and look for the heading Files.
  4. 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.6 to PATH” checkbox and click on “Install Now”, as shown here:

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 → Windows System → 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.)

Note: if you are using an older version of Windows (7, Vista, or any older version) and the Python 3.6.x installer fails with an error, you can try either:

  1. Install all Windows Updates and try to install Python 3.6 again; or
  2. Install an older version of Python, e.g., 3.4.6.

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”:

OS X

Note: 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/release/python-361/ and download the Python installer:

  • Download the Mac OS X 64-bit/32-bit installer file,
  • Double click python-3.6.1-macosx10.6.pkg to run the installer.

Linux

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.6.1 

If you have a different ‘micro version’ of Python installed, e.g. 3.6.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:

Debian or Ubuntu

Type this command into your console:

$ sudo apt install python3.6

Fedora

Use this command in your console:

$ sudo dnf install python3

If you’re on older Fedora versions you might get an error that the command dnf is not found. In that case, you need to use yum instead.

openSUSE

Use this command in your console:

$ sudo zypper install python3 

Verify the installation was successful by opening a command prompt and running the python3command:

$ python3 --version
Python 3.6.1

NOTE: 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.6.

The tutorials in the next section will still allow you to execute code in CommonLounge but it is an important skill to be able to develop on your own computer. When you are working in the industry, you’ll be expected to be familiar with how to install Python and have your own working programming environment.

As always, our goal is to teach you the best practices that you’ll need in the real-world!


© 2016-2022. All rights reserved.