Search code examples
pythonmatplotlibmacports

additional python installed upon installing matplotlib with macports


I am having trouble installing matplotlib on mac os 10.6, so I used macports and installed all dependencies it needed, which is great, but on top of it a new python version. Now I have two python versions and that bothers me. The matplotlib is working fine on the macport python, and the rest of my stuff is with the default python. What is the best solution for integrating both into one, and which one to use as the default python?

I tried copying all packages from my default python /defaultPython/../site-packages into the /opt/../site-packages. Same thing would be to add /defaultPython/../site-packages on the PYTHONPATH of macports python. Some did work fine, but not all.

For example on

import scipy.sparse

I got this error

import _csr
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/sparse/sparsetools/_csr.so, 2): no suitable image found.  Did find:
    /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/sparse/sparsetools/_csr.so: no matching architecture in universal wrapper

Any thoughts or dirty fix for this?

Thanks a lot!


Solution

  • You should never remove or alter the system Python that Apple supplies with Mac OS X -- that's the specific build they've tested their OS with, and you really don't want to break that.

    If you want to use handy macports-installed extensions, you need the macports version of Python for that purpose, so you can't remove that either.

    There is no real reason to worry because you have more than one Python version on your system (I typically have at least half a dozen on mine;-).

    Just put /opt/... (wherever macports keeps its bin directory) at the start of your PATH environment variable (e.g. in .bashrc) and make sure you install with the macports Python any extension you need there.