Archive for the ‘Python Tips & Tricks’ Category

How to install a new Python module in your computer

Monday, January 26th, 2009

In most of cases, if you want to install a new Python module in your computer, you must follow these easy steps:

1. download the module zip file
2. open Terminal in Mac OS X or Prompt-DOS in Windows and go to the right directory
3. write this first line of code: python setup.py build (then press Enter key)
When you launch this command, Python start to create “ecosystem” for this new module
4. finally install the module with this line of code: python setup.py install (and press Enter key).
In this case Python copies all files in the Python Framework directory and install module libraries.

To install a module in Python you must install a C compiler in your computer like GCC (you install it with XCode for Mac), if you don’t have this compiler, you can’t install any modules on your machine.

Set Python Interpreter in Eclipse or Aptana

Friday, January 23rd, 2009

When you install a new Python module on your computer, all stuff will be copy in /Library/Frameworks/Python.framework/versions/2.5/ (or equivalent in Win computers) so if you set Python Interpreter (Eclispe>Preferences>PyDev>Interpreter Python) in Eclipse or Aptana in bin folder of this path you can find all new module when you work with those IDE.
But if you set a couple of folder before like /Library/Frameworks/Python.framework/versions/2.5/ you can find everything you need to work with new Python modules.