You have two pythons installed on your machine, one is the standard python that comes with Mac OSX and the second is the one you installed with ports (this is the one that has
matplotlib installed in its library, the one that comes with macosx does not).
Is the standard mac python and since it doesn’t have
matplotlib you should always start your script with the one installed with ports.
python your_script.py works then change the
Or put the full path to the python interpreter that has the
matplotlib installed in its library.