Skip to content

Installing Python

Installing Python

After you download your copy of Python, it’s time to install it on your system. The downloaded file contains everything needed to get you started:


  • Python interpreter
  • Help files (documentation)
  • Command-line access
  • Integrated DeveLopment Environment (IDLE) application
  • Uninstaller (only on platforms that require it)



This book assumes that you’re using one of the default Python setups found at The follow- ing sections describe how to install Python on the three platforms directly supported by this book: Windows, Mac OS X, and Linux.



Working with Windows

The installation process on a Windows system follows the same procedure that you use for other application types. The main difference is in finding the file you downloaded so that you can begin the installation process. The fol- lowing procedure should work fine on any Windows system, whether you use the 32-bit or the 64-bit version of Python.


  1. Locate the downloaded copy of Python on your

The name of this file varies, but normally it appears as python-3.3.4.msi for 32-bit systems and python-3.3.4.amd64.msi for 64-bit systems. The version number is embedded as part of the filename. In this case, the file- name refers to version 3.3.4, which is the version used for this book.

  1. Double-click the installation

(You may see an Open File – Security Warning dialog box that asks whether you want to run this file. Click Run if you see this dialog box pop up.) You see a Python Setup dialog box similar to the one shown in Figure 2-3. The exact dialog box you see depends on which version of the Python installation program you download.












Figure 2-3: The setup process begins by asking you who should have access to Python.




  1. Choose a user installation option (the book uses the default setting of Install for All Users) and click

Install asks you to provide the name of an installation directory for Python, as shown in Figure 2-4. Using the default destination will save you time and effort later. However, you can install Python anywhere you desire.













Figure 2-4:

Decide on an installation location for your copy of




Using the Windows \Program Files or \Program Files (x86) folder is problematic for two reasons. First, the folder name has a space in it, which makes it hard to access from within the application. Second, the folder usually requires administrator access, so you’ll constantly battle the User Account Control (UAC) feature of Windows if you install Python in either folder.

4y.peT a destination folder name, if necessary, and click Next.

Python asks you to customize its installation, as shown in Figure 2-5.

Enabling the Add python.exe to Path option will save you time later. This feature makes it possible to access Python from the Command Prompt window. Don’t worry too much about how you use this feature just yet, but it really is a good feature to have installed. The book assumes that you’ve enabled this feature. Don’t worry about the other features you see in Figure 2-5. They’re all enabled by default, which provides you with maximum access to Python functionality.















Figure 2-5: Customize your instal­ lation to meet your




  1. (Optional) Click the down arrow next to the Add exe to Path option and choose the Will Be Installed On Local Drive option.
  2. Click

You see the installation process start. At some point, you might see a User Account Control dialog box asking whether you want to perform the install. If you see this dialog box, click Yes. The installation continues and you see an Installation Complete dialog box.

  1. Click

Python is ready for use.



Working with the Mac

Your Mac system likely already has Python installed on it. However, this installation is normally a few years old — or whatever the age of your system happens to be. For the purposes of this book, the installation will likely work fine. You won’t be testing the limits of Python programming technology — just getting a great start using Python.



The Leopard version of OS X (10.5) uses a really old version of Python 2.5.1. This particular version lacks direct access to the IDLE application. As a result, you may find that some book exercises won’t work properly. The article at tells you more about how to overcome this particular issue. The newest version of OS X at the time of this writing (Mavericks, or 10.9) comes with Python 2.7, which is just fine for working through the examples in the book.


Depending on how you use Python, you might want to update your installa- tion at some point. Part of this process involves installing the GNU Compiler Collection (GCC) tools so that Python has access to the low-level resources it needs. The following steps get you started with installing a new version of Python on your Mac OS X system.


  1. Navigate to

with your browser.

You see information regarding the latest version of Python, as shown in Figure 2-1.

  1. Click the appropriate link for your version of OS X:
    1. Python 3.4 Mac OS X 64-bit/32-bit x86-64/i386 Installer for 32-bit or 64-bit versions on the Intel processor
    2. Python 3.4 Mac OS X 32-bit i386/PPC Installer for 32-bit versions on the Power PC processor

The Python disk image begins downloading. Be patient: The disk image requires several minutes to download. Most browsers provide a method for monitoring the download process so that you can easily see how long the download will take. When the download is complete, your Mac automatically opens the disk image for you.

The disk image actually looks like a folder. Inside this folder, you see a number of files, including python.mpkg. The python.mpkg file is the one that contains the Python application. The text files contain informa- tion about the build, licensing, and any late-breaking notes.

  1. Double-click mpkg.

You see a Welcome dialog box that tells you about this particular Python build.

  1. Click Continue three

The installation program displays late-breaking notes about Python, licensing information (click Agree when asked about the licensing information), and, finally, a destination dialog box.



  1. Select the Volume (hard drive or other media) that you want to use for installing Python and click

The Installation Type dialog box appears. This dialog box performs two tasks:

  • Click Customize to change the feature set that is installed on your


  • Click Change Install Location to modify the place where the

installer places Python.

The book assumes that you’re performing a standard installation and that you haven’t changed the installation location. However, these options are available in case you want to use them.

  1. Click

The installer may request your administrator password. Type the admin- istrator name and password, if required, into the dialog box and click OK. You see an Installing Python dialog box. The contents of this dialog box will change as the installation process proceeds so that you know what part of Python the installer is working with.

After the installation is completed, you see an Install Succeeded dialog box.

  1. Click

Python is ready to use. (You can close the disk image at this point and remove it from your system.)



Working with Linux

Some versions of Linux come with Python installed. For example, if you have a Red Hat Package Manager (RPM)-based distribution (such as SUSE, Red   Hat, Yellow Dog, Fedora Core, and CentOS), you likely already have Python on your system and don’t need to do anything else.


Depending on which version of Linux you use, the version of Python varies and some systems don’t include the Interactive DeveLopment Environment (IDLE) application. If you have an older version of Python (2.5.1 or earlier), you might want to install a newer version so that you have access to IDLE. Many of the book exercises require use of IDLE.


You actually have two techniques to use to install Python on Linux. The following sections discuss both techniques. The first technique works on any Linux distribution; the second technique has special criteria that you must meet.



Using the standard Linux installation

The standard Linux installation works on any system. However, it requires you to work at the Terminal and type commands to complete it. Some of the actual commands may vary by version of Linux. The information at http:// provides some helpful tips that you can use in addition to the procedure that follows.


  1. Navigate to

with your browser.

You see information regarding the latest version of Python, as shown in Figure 2-1.

  1. Click the appropriate link for your version of Linux:
    1. Python 3.4 compressed source tarball (any version of Linux)
    2. Python 3.4 xzipped source tarball (better compression and faster download)
  2. When asked whether you want to open or save the file, choose

The Python source files begin downloading. Be patient: The source files require a minute or two to download.

  1. Double-click the downloaded

The Archive Manager window opens. After the files are extracted, you see the Python 3.3.4 folder in the Archive Manager window.

  1. Double-click the Python 3.4 folder.

The Archive Manager extracts the files to the Python 3.3.4 subfolder of your home folder.

  1. Open a copy of

The Terminal window appears. If you have never built any software on  your system before, you must install the build essentials, SQLite, and bzip2 or the Python installation will fail. Otherwise, you can skip to Step 10 to begin working with Python immediately.

  1. Type sudo apt-get install build-essential and press Enter.

Linux installs the Build Essential support required to build packages (see for details).

  1. Type sudo apt-get install libsqlite3-dev and press Enter.

Linux installs the SQLite support required by Python for database manipulation (see libsqlite3-dev for details).



  1. Type sudo apt-get install libbz2-dev and press Enter.

Linux installs the bzip2 support required by Python for archive manipu- lation (see for details).

  1. Type CD Python 3.4 in the Terminal window and press Enter.

Terminal changes directories to the Python 3.3.4 folder on your system.

  1. Type ./configure and press Enter.

The script begins by checking the system build type and then performs a series of tasks based on the system you’re using. This process can require a minute or two because there is a large list of items to check.

  1. Type make and press Enter.

Linux executes the make script to create the Python application software. The make process can require up to a minute — it depends on the pro- cessing speed of your system.

  1. Type sudo make altinstall and press Enter.

The system may ask you for your administrator password. Type your password and press Enter. At this point, a number of tasks take place as the system installs Python on your system.


Using the graphical Linux installation

All versions of Linux support the standard installation discussed in the “Using the standard Linux installation” section of this chapter. However,   a few versions of Debian-based Linux distributions, such as Ubuntu 12.x and later, provide a graphical installation technique as well. You need the administrator group (sudo) password to use this procedure, so having it handy will save you time. The following steps outline the graphical instal- lation technique for Ubuntu, but the technique is similar for other Linux installations:


  1. Open the Ubuntu Software Center (The folder may be named Synaptics on other platforms.)

You see a listing of the most popular software available for download and installation.

  1. Select Developer Tools (or Development) from the All Software drop- down list

You see a listing of developer tools, including Python.

  1. Double-click the Python 3.4 entry.

The Ubuntu Software Center provides details about the Python 3.3.4 entry and offers to install it for you.



  1. Click

Ubuntu begins the process of installing Python. A progress bar shows the download and installation status. When the installation is complete, the Install button changes to a Remove button.

  1. Close the Ubuntu Software Center

You see a Python icon added to the desktop. Python is ready for use.