Tag Archives: Enthought

Starting with Python

python logo
Python logo

For about a year I have been programming in Python as a Matlab alternative. I love Matlab but I can’t afford being tied to a licence. Python is free, open source, and so far I have been able to do everything I did with Matlab. I am fairly impressed!

Python is becoming, or it may be already, a main stream programming language, specially for open source software. Since it’s a scripting language a lot of programs use it for scripting in that app. A few examples are Blender for 3D modeling and animation, FreeCad for 3D mechanical modeling, Fenics for solving differential equations by finite element methods, etc. Many universities have adopted Python in their class work, MIT, Georgia Tech, UC Davis, etc.

If you want to start with Python let me recommend the following:

  1. Use Enthought! Yes, I know … there is also a licence attached if you really want full support and all the packages. But it’s free if you have a .edu email and even if you don’t have one there is a totally free version of Enhtought: Canopy Express! By the way, the Enthought distro works on Mac, Linux and Windows. It’s perfect!
  2. If you really… really don’t want to be attached to a licence (I made my peace with Enthought since they have a free version) you can use Spyderlib. It’s also an Integrated Development Environment (IDE) like Enthought but has a few less python libraries… but you can install them separately with a bit of pain.

If you want to lear more about Python and how to get started check these references:

Python, VPython and Enthought

For those who are starting to work with Python this may be useful.

I have been trying to use VPython for a while with the Enthought distro to develop Python software. (I’m using 32 bit Python 2.7 Enthought distro for Mac OSX 10.6.8).

But for some reason the VPython package will not be installed if the Python distribution in your mac is not the official one (e.g. oficial Python 2.7 installed in /Library/Frameworks/Python.framework/Versions/2.7)

The Enthought distro installs itself in

/Library/Frameworks/Python.framework/Versions/Current

as a symbolic link to

/Library/Frameworks/Python.framework/Versions/7.2

Which is not right for VPython because it expects the default link to be ‘2.7’.

Ok, what I did was to delete the official 2.7 Python distro and create a symbolic link ‘2.7’ to the ‘7.2’ EDP version. And it works great!

To create the symbolic link just open the terminal and do:
>> cd /Library/Frameworks/Python.framework/Versions
>> sudo ln -s 7.2 2.7

Now open Python:
>> python

and type
from visual import *
sphere()

you should see a sphere draw like this:

Now Python works well with Enthought.

References
http://vpython.org/
http://www.enthought.com/