Beginning Programming with Python For Dummies
Book image
Explore Book Buy On Amazon

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.

You actually have two techniques to use to install Python on Linux. 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 on Python installations provides some helpful tips that you can use in addition to the procedure that follows.

  1. Navigate to the Python download site with your browser.

    You see information regarding the latest version of Python.

  2. Click the appropriate link for your version of Linux:

    1. Python 3.3.4 compressed source tarball (any version of Linux)

    2. Python 3.3.4 xzipped source tarball (better compression and faster download)

  3. When asked whether you want to open or save the file, choose Save.

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

  4. Double-click the downloaded file.

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

  5. Double-click the Python 3.3.4 folder.

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

  6. Open a copy of Terminal.

    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.

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

    Linux installs the Build Essential support required to build packages.

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

    Linux installs the SQLite support required by Python for database manipulation.

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

    Linux installs the bzip2 support required by Python for archive manipulation.

  10. Type CD Python 3.3.4 in the Terminal window and press Enter.

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

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

  12. 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 processing speed of your system.

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

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 installation technique for Ubuntu, but the technique is similar for other Linux installations:

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

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

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

    You see a listing of developer tools, including Python.

  3. Double-click the Python 3.3.4 entry.

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

  4. Click Install.

    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.

  5. 5.Close the Ubuntu Software Center folder.

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

About This Article

This article can be found in the category: