Unfortuantly, SimpleITK links your system Python rather than your Homebrew Python, i.e.
$ pip install SimpleITK
$ python
Python 2.7.12 (default, Jun 29 2016, 14:05:02)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import SimpleITK
Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6It’s easily fixed with otool and install_name_tool:
$ pip install SimpleITK
$ otool -L /usr/local/lib/python2.7/site-packages/SimpleITK/_SimpleITK.so
/usr/local/lib/python2.7/site-packages/SimpleITK/_SimpleITK.so:
/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.1)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 635.19.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
$ install_name_tool -change /System/Library/Frameworks/Python.framework/Versions/2.7/Python \
/usr/local/Frameworks/Python.framework/Python \
/usr/local/lib/python2.7/site-packages/SimpleITK/_SimpleITK.so
$ python
Python 2.7.12 (default, Jun 29 2016, 14:05:02)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import SimpleITK
>>> exit()Enjoy!
❤️ 💯 🎉