I have a MacBook Pro with Snow Leopard, and the Python 2.6 distribution that comes standard. Numpy does not work properly on it. Loadtxt gives errors of the filename being too long, and getfromtxt does not work at all (no object in module error). So then I tried downloading the py26-numpy port on MacPorts. Of course when I use python, it defaults the mac distribution. How can I switch it to use the latest and greatest from MacPorts. This seems so much simpler than building all the tools I need from source…
Thanks!
First of all, add the MacPorts path (
/opt/local/bin) to your$PATH. In.bashrc(or whatever shell config file you use):If you have multiple versions of Python installed via MacPorts, and/or want to easily switch between the MacPorts and Apple distributions, you can install the python_select port as well.
Also note that the MacPorts version of Python 2.6 is installed into
/opt/local/bin/python2.6, so to use that interpreter, you’ll have to do one of three things:python2.6(not justpython).pythoncallspython2.6(alias python=python2.6)./opt/local/bin/python->/opt/local/bin/python2.6.python_selectto set the Python used by callingpython.Options #3 or #4 are probably the best bet.