Learn Django

Install Python

According to its website, python.org, "Python is a programming language that lets you work quickly and integrate systems more effectively." It is the programming language that Django is based on, and is therefore used to create the CRM Easy application.

This course requires a 2.7 version of Python. As you'll come to discover, using the right version of any software component is important. The application we build in this course will use several third-party packages. When these packages are created they are tested against specific versions of Python and other software components like Django. Using an untested version may cause immediate and obvious errors; other times errors will only occur in some situations. Therefore it's critical that every version of software you use is the correct version, starting with Python.

Install Python On a Mac

Below are the steps to install Python on a Mac.

Step 1: Verify Which Version of Python is Installed

Macs come with Python pre-installed. Again, this course uses the 2.7.x (e.g. 2.7.5 or 2.7.6) version of Python. Some Mac OS X releases have a different version of Python installed. Therefore the first step is to verify what version of Python is installed on your computer. If it isn't in the 2.7.x range then it will need to be updated.

To check which version of Python is installed open a terminal window by going into Spotlight (the magnifier in the upper right corner) and typing 'terminal'.

Once the terminal is open, type python into it. This will start the Python interpreter, which will also show you the version number. In the following example the Python version is 2.7.5.

$ python
Python 2.7.5 (default, Aug  1 2013, 01:01:17) 
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

Step 2: Install the Right Version of Python

If the version of Python on your computer is not in the 2.7.x range, then you need to install the correct version. Installing Python on a Mac can be tricky. If you perform a quick search on the web you'll see many blog posts and articles detailing different methods. One of the cleanest ways I've found is to use Macports, which is a package management system for the Mac that simplifies tasks like installation. In the following steps you'll download Macports and use it to get the proper version of Python.

  1. Open MacPorts Install
  2. This page provides multiple installation options. The easiest one is to use the 'pkg' installer for your version of Mac OS X e.g. Mountain Lion. Follow the setps to download the .pkg file to your computer. Once downloaded, open it and follow the prompts
  3. If you have terminal window open, close it and open a new one
  4. At the terminal, run the command sudo port install python27. This will install the latest build of the 2.7.x Python, which at the time of writing is 2.7.9
  5. Close your terminal and open a new one
  6. Type python again to check the version. It should now be 2.7.9
  7. If Python 2.7.9 does not load, exit (by typing exit()), and type python2.7

Install Python On Windows

These are the instructions for setting up a Windows development environment.

Step 1: Verify if Python is Installed

Windows does not come with Python pre-installed. However, there's a chance you've installed it in the past, or that a program you've used has installed it. Follow these steps to see if Python is installed (this will work on Windows 7 or 8; not sure about earlier versions).

  1. Open the Windows search feature. For Windows 7 this is easily done by clicking on the Start button. For Windows 8, open the Charms Bar and click on the search icon
  2. Type 'python' into the search box. If Python is installed it should show in the results pane
  3. If Python is listed, click on it to open it. This should open the Python Interpreter.
  4. Note the version number. If it's not in the 2.7.x range proceed to Step 2 below to install the right version

Step 2: Install Python 2.7.x (If Required)

If the right version of Python isn't installed, follow these procedures to install it.

  1. Open Python 2.7.9 Download
  2. On the page that opens, find the list of files
  3. Locate the correct Windows installer for your operating system. If you have a 32-bit version of Windows, the file name will be "Windows x86 MSI". If you're running a 64-bit system, it will be "Windows x86-64 MSI". Note which version you install
  4. Once downloaded, run the .exe Installer. Note the location that Python is installed to. By default it should be C:\Python27. This location is important as you'll likely need to reference the install location later on.

When you run the Python installer, you'll come to a screen like the one shown below. Be sure to select the very last item in the list (Add python.exe to Path).

To verify Python can be accessed anywhere, close and reopen the Command Prompt. With a new prompt open type python. The Python interpreter should open.

Track your progress with a free account