Luckily for us, Python comes pre-installed on most versions of Mac OS X and many flavors of Linux (both the latest versions of Ubuntu and Fedora come with Python 2.7 or later versions out of the box). Thus, we really don't have a lot to do for this recipe, except check whether everything is installed.
For this book, we will work with Python 3.4.0.
Just make sure you have a good Internet connection in case we need to install anything.
Perform the following steps in the command prompt:
- Open a new Terminal window and type the following command:
which python
- If you have Python installed, you should see something like this:
/usr/bin/python
- Next, check which version you are running with the following command:
python --version
If you are planning on using OS X, you might want to set up a separate Python distribution on your machine for a few reasons. First, each time Apple upgrades your OS, it can and will obliterate your installed Python packages, forcing a reinstall of all previously installed packages. Secondly, new versions of Python will be released more frequently than Apple will update the Python distribution included with OS X. Thus, if you want to stay on the bleeding edge of Python releases, it is best to install your own distribution. Finally, Apple's Python release is slightly different from the official Python release and is located in a nonstandard location on the hard drive.
There are a number of tutorials available online to help walk you through the installation and setup of a separate Python distribution on your Mac. We recommend an excellent guide, available at http://docs.python-guide.org/en/latest/starting/install/osx/ , to install a separate Python distribution on your Mac.
You can also refer to the following:
- Refer to the Python For Beginners guide at http://www.python.org/about/gettingstarted/
- Refer to The Hitchhiker's Guide to Python at http://docs.python-guide.org/en/latest/
- Refer to the Python Development Environment onMac OS X Mavericks 10.9 article at http://hackercodex.com/guide/python-development-environment-on-mac-osx/