[英]OSError when trying to import a sklearn dataset into Jupyter Notebook
[英]OSError when trying to run XGBoost on Jupyter Notebook
我通過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)
我該怎么辦?
解決了。 再次在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/backend/cython/../../../../.././libstdc++.so。 66:找不到版本'GLIBCXX_3.4.20'(/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。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.