Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 无法在Mac中加载xgboost_Python 3.x_Xgboost - Fatal编程技术网

Python 3.x 无法在Mac中加载xgboost

Python 3.x 无法在Mac中加载xgboost,python-3.x,xgboost,Python 3.x,Xgboost,我试图运行下面的代码。这是的GitHub代码 jupyter笔记本的链接如下所示 在那里我无法加载xgboost 试图在单元格下运行,它显示一些错误 ## Hyperparameter optimization using RandomizedSearchCV from sklearn.model_selection import RandomizedSearchCV, GridSearchCV import xgboost 错误: ------------------------------

我试图运行下面的代码。这是的GitHub代码

jupyter笔记本的链接如下所示

在那里我无法加载xgboost

试图在单元格下运行,它显示一些错误

## Hyperparameter optimization using RandomizedSearchCV
from sklearn.model_selection import RandomizedSearchCV, GridSearchCV
import xgboost
错误:

---------------------------------------------------------------------------
XGBoostError                              Traceback (most recent call last)
<ipython-input-11-60e28ccb95f6> in <module>
      1 ## Hyperparameter optimization using RandomizedSearchCV
      2 from sklearn.model_selection import RandomizedSearchCV, GridSearchCV
----> 3 import xgboost

~/opt/anaconda3/lib/python3.8/site-packages/xgboost/__init__.py in <module>
      7 import os
      8 
----> 9 from .core import DMatrix, DeviceQuantileDMatrix, Booster
     10 from .training import train, cv
     11 from . import rabit  # noqa

~/opt/anaconda3/lib/python3.8/site-packages/xgboost/core.py in <module>
    171 
    172 # load the XGBoost library globally
--> 173 _LIB = _load_lib()
    174 
    175 

~/opt/anaconda3/lib/python3.8/site-packages/xgboost/core.py in _load_lib()
    154     if not lib_success:
    155         libname = os.path.basename(lib_paths[0])
--> 156         raise XGBoostError(
    157             'XGBoost Library ({}) could not be loaded.\n'.format(libname) +
    158             'Likely causes:\n' +

XGBoostError: XGBoost Library (libxgboost.dylib) could not be loaded.
Likely causes:
  * OpenMP runtime is not installed (vcomp140.dll or libgomp-1.dll for Windows, libomp.dylib for Mac OSX, libgomp.so for Linux and other UNIX-like OSes). Mac OSX users: Run `brew install libomp` to install OpenMP runtime.
  * You are running 32-bit Python on a 64-bit OS
Error message(s): ['dlopen(/Users/danishali/opt/anaconda3/lib/python3.8/site-packages/xgboost/lib/libxgboost.dylib, 6): Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib\n  Referenced from: /Users/danishali/opt/anaconda3/lib/python3.8/site-packages/xgboost/lib/libxgboost.dylib\n  Reason: image not found']
我尝试的是:

水蟒 内置64位python的anaconda。
仍然是相同的错误首先,我通过pip安装了xgboost,我得到了相同的错误。 然后,我通过代码:pip uninstall xgboost卸载了它,并通过代码:conda install py xgboost再次通过anaconda安装了它。
现在我可以导入xgboost了,没有任何错误。

首先,我是通过pip安装xgboost的,我得到了相同的错误。 然后,我通过代码:pip uninstall xgboost卸载了它,并通过代码:conda install py xgboost再次通过anaconda安装了它。 现在我可以毫无错误地导入xgboost了