I am using Anaconda. I first switched to Python2 (Version 2.7.11).
python -V
Python 2.7.11 :: Continuum Analytics, Inc.
I used the followin
Library not loaded: @rpath/./libgomp.1.dylib
This is the key.
In my case, it is " Library not loaded: /usr/local/opt/gcc/lib/gcc/6/libgomp.1.dylib"
I check my path "/usr/local/opt/gcc/lib/gcc"
and there is only a folder named 7 there , no 6.
So i use "sudo find / -name libgomp.1.dylib" to locate all the gcc version i have installed, with I found that there is a version 6 in another location.
Then I create a folder named 6 under '/usr/local/opt/gcc/lib/gcc' and copy those gcc 6 files in there .
Finally , "import xgboost" works with no error .