Constant adding to DYLD_LIBRARY_PATH on MAC causes X11 errors

I am using Python 2.7 and trying to import graph_tool, and it seems that my libboost_thread-mt.dylib is in / opt / local / lib, and not / usr / local / lib.

If I started the X11 terminal and typed

export DYLD_LIBRARY_PATH='/opt/local/lib' 

then Python successfully imports graph_tool. On the other hand, if I add

  export DYLD_LIBRARY_PATH='/opt/local/lib':$DYLD_LIBRARY_PATH 

before ~/.bash_profile , X11 stops working. I am really confused by what is going on here. Why can't I add /opt/local/lib to $DYLD_LIBRARY_PATH forever without destroying my computer?

Any help is greatly appreciated. Thank you

+2
python dyld graph-tool
source share
1 answer

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 .

+3
source share

All Articles