About Python software distributions
With the exception of Windows, most modern operating systems ship with some version of Python pre-installed.
Although this version may not be compatible with Plone 3.3, it is still useful to have around.
In case Python is not pre-installed, you should install Python 2.4 because that version works with Plone 3.3. We will get to that later in the chapter.
Using Python on Mac OS X
Mac OS X 10.6 is shipped with Python 2.6 pre-installed. Although this version will not work with Plone 3.3, we can use it to install the following:
Distribute
PIP
Buildout
But first, let us explore some basic Python usage.
Verify that Python works
To verify that Python works, open Finder | Applications | Utilities | Terminal.
Check the version: To check the version, type:
$ python -V
Run the interpreter: To run the interactive Python interpreter, type:
$ python
Exit: To exit, press Ctrl + D.
You should see:
We have just demonstrated using Python 2.6 on Mac OS X.
Installing Python on Windows
Windows 7 does not come pre-installed with Python, but there is an installer available on http://python.org.
Download the Python installer
Since an installer for the latest version (in the 2.4.x series) is not available, and because it is difficult to compile the source on Windows, we will use the 2.4.4 version instead.
Using Internet Explorer (or any other web browser):
Navigate to http://www.python.org/download/releases/2.4.4/.
Scroll down to Windows.
Select python-2.4.4.msi (http://www.python.org/ftp/python/2.4.4/python-2.4.4.msi).
Save the file.
Run the Python installer
Windows will present a series of dialogues which you can answer based on the following suggestions:
Install for all users
Install to the default location
Install the default features
You should see:
Configure the Environment Variable—Path
Now that Python is installed, we would like to be able to easily run the interactive Python interpreter from the Command Prompt. To accomplish this, perform the following steps:
Select Start | Computer | System properties | Advanced system settings | Environment Variables.
Under System variables, scroll down to Path.
Select Edit.
Add the following separated by a semicolon:
C:\Python24
C:\Python24\Scripts
Click on Save.
You should see:
Now, let us test this.
Verify that Python works
To verify that Python works, open Start | All Programs | Accessories | Command Prompt.
Check the version: To check the version, type:
$ python -V
Run the interpreter: To run the interactive Python interpreter, type:
$ python
Exit: To exit, press Ctrl + Z and hit Enter.
You should see:
We have just finished demonstrating how to install and test Python 2.4 on Windows.
While we are here, let us take a minute to install some additional software that we will need later.
Install PyWin
If you were to install and run Plone now, you may encounter the following error:
To avoid this error, install PyWin for Python 2.4:
Browse to http://sourceforge.net/proje cts/pywin32/files/.
Select
pywin32-214.win32-py2.4.exe
to download the file.Run the installer.
The PyWin library provides access to the Windows programming API. Visit http://plone.org/documentation/kb/using-buildout-on-windows/ for more information.
Using Python on Ubuntu Linux
Ubuntu Linux ships with Python 2.6 pre-installed.
All we need to do is test it.
Verify that Python works
To verify that Python works, open Applications | Accessories | Terminal.
Check the version: To check the version, type:
$ python -V
Run the interpreter: To run the interactive Python interpreter, type:
$ python
Exit: To exit, press Ctrl + D.
You should see:
We have just finished demonstrating how to test Python 2.4 on Ubuntu Linux.
At this point, we have taken steps to explore Python on each of our targeted operating systems.
We will now move forward with that technology.