Python is an amazing language, but specially in Windows (thats where the focus of this article will be), it takes some time to set it up (and understand all the possible configurations).
First you'll need a Python distribution. You can get the standard one, called CPython, from the
official Python page. There are other alternatives, discussed below (all of them are also discused on the Python site)
- IronPython, which is a totally different language, but with the same syntax (or very, very close). It targets the .Net framework, so if want to use Python interacting with .Net code, this is your best choice. We'll do a separate post for setting up IronPython, the rest of the post applies only to Python
- Jython, which targets the Java Virtual Machine. Same thing here, you want to use Java code from Python, use Jython. Same thing as IronPython
- Bundles from vendors (some free, some paid) This are usually versions of CPython with some that some of the most used python libraries and some IDE included
I used the
Enthought distribution but the
ActiveState is worth taking a look also. Of course you can also install the CPython distribution and then get the rest of the libraries and an IDE.
If you are running a 64 bits OS, you might want to try the 64 bit version of Python. The problem is that some packages have some compiled C which runs on 32 bits. So for better interoperability, I suggest always installing the 32 bits version of the distribution. If you need to manage huge amounts of data (over 2 Gb) then you might consider the 64 bits, but try to stick with the 32 bits version.
As for the choice between Python 2.x and 3.x, I stuck with 2.x cause of compatibility
After you get your distribution, you'll probably want to get the
SetupTools package from
PyPi, the official Python Package Index. It has a tool, Easy_Install, which allows you to install other packages really easy. SetupTools has a Windows installer
After having SetupTools, you should get NumPy and SciPy right away (at least if you plan to use Python to do some math calculations). NumPy and SciPy are included in the Enthough and ActiveState distributions. If you used the standard CPython installer, then you can use easy_install to get them
Some people just develop with a text editor (I recommend
Notepad++, some people like the Scintilla-based
SciTE) and the command prompt. To this, just create your python scripts with the text editor and the run them from the prompt using
python myScriptFile.py
The python.exe executable must be in the path, if you get "python is not a recognized..." then add the Python dir to the path
If you want an IDE, I have made a list (after looking for one myself). All of them have syntax completion and a debugger, besides an incorporated interactive python shell (very similar to running python in the cmd line and then start sending code)
- Komodo Edit (I think it also comes bundled with the ActiveState distribution)
- PyScripter
- Spyder (requires installing PyQt) targeted to a Matlab used audience
- IDLE (comes bundled with the Enthough distribution)
- Eric Python IDE (I haven't used it but it is highly recommended, has several prerequisites)
Stay tuned for more Python related posts!