Solution:
This issue may happen in case the .so
file from homebrew's formula links against a different python
library than the interpreter you are running, view also this thread and this response.
In case you have no other dependencies then running your program employing the python interpreter from homebrew (which must be located in /usr/local/bin/
) may solve the problem.
And you'll possibly require to employ the install_name_tool
to point the library to the right python like this:
sudo install_name_tool -change libpython2.7.dylib ~/anaconda/lib/libpython2.7.dylib /usr/local/caffe2/python/caffe2_pybind11_state.so
This is occured by linking a static version of libpython into ycmd's ycm_core.so. This leads to multiple copies of the python interpreter loaded at the time python loads ycmd_core. Hence and this messes up python's global state. The details aren't significant.
The solution is that the version of Python linked and run against should be built with either --enable-shared or --enable-framework (on OS X). This is acquired as follows (NOTE: for Mac, replace --enable-shared with --enable-framework):
At the time building python from source: ./configure --enable-shared {options}
At the time building python from pyenv: PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install {version}
I got the cause: cmake-3.5
with GUI compile SimpleElastix by python-app which is a pre-installed version by OS-X, however the excute python in my command line is installed by homebrew
or pyenv
or macport
or anything else. After failed employing otool -L
and install_name_tool
to switch dynmaic link library, i pursue this post to switch python by myself:
1.Delete old python version by OS-X:
sudo mv /System/Library/Frameworks/Python.framework/Versions/2.7 /System/Library/Frameworks/Python.framework/Versions/2.7_bak
Move the new python:
sudo mv /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7 /System/Library/Frameworks/Python.framework/Versions/2.7
3.Setting group to wheel
if required:
sudo chown -R root:wheel /System/Library/Frameworks/Python.framework/Versions/2.7
4. Updating the current link if required:
sudo rm /System/Library/Frameworks/Python.framework/Versions/Current sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7 /System/Library/Frameworks/Python.framework/Versions/Current