Trying to set DYLD_LIBRARY_PATH permanently is almost always a sign that you are doing something wrong. In OS X, well-designed components embed absolute paths or RPATH in shared libraries, so it is rarely necessary to reassign environment variables for library search paths.
Since you are showing the path /opt/local/lib , I assume that you are using MacPorts as this is its default installation path. If you cannot import the installed MacPorts Python package, most likely you are using the wrong instance of Python. MacPorts installs all Python packages in its own Python interpreter. So, if you installed Python 2.7 with:
sudo port install py27-graph-tool
MacPorts also installed, if not already installed, its own python2.7 in /opt/local/bin . Try running this and import there.
/opt/local/bin/python2.7
If you have not already done so, you should add /opt/local/bin to your PATH shell in the shell startup file, for example ~/.profile , so you do not always need to enter /opt/local/bin .
Ned deily
source share