Getting started with Python (part 1)

When I wanted to start programming with Python, like most programmers, I looked for an IDE of some kind. All the results I found seemed to have a list of dependencies, none of which I knew anything about. After a few hours, I decided to forget it.

A few months down the road, I came across a neat package called Portable Python. This package had a Python distribution, two IDEs and some libraries, all configured and ready to go. At the time, I didn’t have any new programming projects planned, so I filed the link in my bookmarks.

About a week ago, I finally had a project I could try in Python. I downloaded Portable Python, and got to work. After a few hours in the Python docs, I completed the script.

The only problem with the above solution was that it wasn’t a normal Python distribution. Installing libraries would be difficult at best. I decided that I needed to have a regular Python distribution, with all the functionality that I was getting from Portable Python.

After a few hours, I had completed my goal. Hopefully, the below tutorial will save you a few hours.

I strongly recommend that you have a C++ compiler (Visual Studio 2008 (which is what I used) or Visual C++ 2008 Express (free)) on the machine where you are going to setup your development environment. Sometimes Python libraries don’t offer binary packages for your platform, or for your version of Python. There are some projects that don’t offer binaries at all. Anyone who has experience with Linux knows about installing from source, and the same concepts are present with Python libraries.

Now that you’ve installed a C++ compiler (you listened to me right?), we can proceed with the Python installation.

I recommend that you use the 2.6.x release series, since many libraries aren’t available for 3.1.x yet.

Download and Install

First, you’ll need to download Python itself -> Python 2.6.2

Now that you have Python installed, we need to satisfy the dependencies for PyScripter, the IDE that we’ll be installing.

The only dependency of PyScripter that we have to deal with is RPyC. RPyC has three dependencies, two of which we have to build from source.

tlslite

  1. Download a source package of tlslite (or install the binary tlslite-0.3.8.win32-py2.6.exe (516))
  2. Extract the source package
  3. Open a DOS prompt to the folder containing setup.py
  4. Type setup.py install

pycrypto

  1. You must have a C++ compiler installed or you will not be able to build this package
  2. Download a source package of pycrypto (or install the binary pycrypto-2.0.1.win32-py2.6.exe (474))
  3. Extract the source package
  4. Open a DOS prompt to the folder containing setup.py
  5. Type setup.py install

PyOpenSSL

  1. Download and install a nice binary package of PyOpenSSL

We have satisfied RPyC’s dependencies. Download and install a binary package of RPyC from here.

We have satisfied PyScripter’s dependencies. Download and install a binary package of PyScripter from here.

Now our IDE is installed and ready to go. You could stop at this point, but there are two more packages I recommend you install.

Some Python packages come packaged with setuptools, which will automatically installs dependencies when you install a package. Sometimes, these packages come as Python “eggs”, which are just zip files with a special internal folder structure.

You can use the setuptools bootstrapper (which I don’t recommend), or build from source. You can download a source package from here. The steps for installing setuptools are the same as the ones we used for tlslite.

Another useful library for development on Windows is pywin32, which provides access to some win32 APIs, and useful functions for manipulating files. You can download a binary package from here.

You’re probably wondering, do people who use my Python programs have to install all this stuff? Not if you package your program with py2exe.

In the next tutorial, we’ll discuss learning Python if you’re a C style (C, C++, Java, C#, etc) language developer.

Comments are closed.