views:

69

answers:

1

Right I'm getting a bit tired of this so hopefully you can help me sort it out once and for all.

I'm really confused about what's going on with Python on my MacBook. I'm running OS X 10.6.2 and have installed python from the website (the package that includes IDLE). This works absolutely fine, and in fact IDLE will run everything I want to, it's just that I don't want to use IDLE.

So, I tried Netbeans, and it's infuriating - it seems to be looking for libraries in completely the wrong place (even when I try and force it to look in different places for Python on my machine). Eclipse did something very similar.

This leads to more problems; how exactly should one install modules into python? -Using MacPorts it seemingly disappears into some depths of opt/local/var/macports where it's found by nothing except IDLE. -Running "python setup.py install" from the command line USUALLY ends up with various errors regarding something like:

warning: in /opt/local/lib/libfreetype.dylib, file is not of required architecture

and then sometimes dumps something in Libraries\Python\2.6\site-packages that doesn't work. -Installing a .dmg version of any module literally seems to do absolutely nothing, can't find any trace of what it's done with it either, even from IDLE.

It seems to be there's different versions of Python running on my machine, with different IDEs looking to different places for Python and it's modules. Aswell as this it seems that every method of installation of modules for python puts them in different places. Should it really be this difficult?

Is there anyway of forcing Netbeans to run a particular version of python? Or is there a way to force everything to use only one of the versions? Also, which paths belong to which versions of Python?

Yours, Seriously confused!

Duncan

A: 

I deal with this by sticking to the macports Python installation. For compatibility reasons, I'm very wary of mixing modules for different python versions.

Using python_select, port installed modules and the macports version of easy_install should ensure that everything is found. In rare cases, you might have to fool with sys.path, but that should only be for 3rd party stuff that doesn't have a better installer.

This solution isn't perfect, but it's worked ok for me. Just make sure you reconfigure your editor to point to the correct interpreter if you start your programs that way. If you need to distribute your software (and can't get in the ports catalog), you can always create a setup tool that targets the native python install.

Dana the Sane
Whats this python_select ? That sounds like a pretty good idea to me! Tempted to wipe all the other python versions after I get one that works properly. Next step is getting Netbeans to point to the interpreter I want (no idea how to do that, but I'll keep looking).
Duncan Tait
`python_select` is a utility that you can get through macports that defines which python interpreter to use by default. This makes it more convenient for you to have multiple interpreter versions installed.For netbeans, there should a variable somewhere that you can set to change the binary path. You might be able to write a start-up bash script is this isn't included in the settings.
Dana the Sane