我通过pip安装了xgboost,并尝试在Jupyter Notebook上运行它。 但是,在运行时
from xgboost import XGBClassifier
在Python 3 jupyter笔记本上,我收到以下错误:
OSError: /home/martin/anaconda3/bin/../lib/libgomp.so.1: version GOMP_4.0' not found (required by /home/martin/anaconda3/lib/python3.6/site-packages/xgboost/./lib/libxgboost.so)
我该怎么办?
答案 0 :(得分:1)
解决。再次,在https://github.com/dmlc/xgboost/issues/1786
找到了解决方案为了让GOMP_4.0正常工作,请按以下步骤操作:
1)在终端上输入以下内容(用自己的路径替换)
strings /home/martin/anaconda3/bin/../lib/libgomp.so.1 |grep GOMP
你会得到一份清单,GOMP_4.0很可能不会出现在那里(如果不是我认为这不会起作用,因为那不是问题)
2)输入
sudo find / -name libgomp.so.1*
您将获得一个地址列表。对每一个重复步骤1(strings <path> |grep GOMP
),直到找到包含GOMP_40(在我的情况下,/usr/lib/x86_64-linux-gnu/libgomp.so.1
)
3)现在输入以下内容,首先输入原始路径,然后输入包含GOMP_4.0的路径
sudo rm -rf <path in anaconda>
sudo ln -s <path with GOMP_4.0> <path in anaconda>
例如:
sudo rm -rf /home/martin/anaconda3/bin/../lib/libgomp.so.1
sudo ln -s /usr/lib/x86_64-linux-gnu/libgomp.so.1 /home/martin/anaconda3/bin/../lib/libgomp.so.1
这应该可以解决问题。不过,在此之后,我遇到了类似的错误:
OSError:/home/martin/anaconda3/lib/python3.6/site-packages/zmq/backe nd / cython /../../../ ../.././libstdc++ .so.6:版本`GLIBCXX_3.4.20&#39;未找到(/home/martin/anaconda3/lib/python3.6/site-packages/xgboost/./lib/libxgboost.so所需)
我以同样的方式解决了这个问题,除了这次,在步骤1)中使用|grep GLIBCXX
,在步骤2中使用sudo find / -name libgomp.so.1*
,这次查找GLIBCXX_3.4.20。