如何修复 MacOs 中的 xgboost 导入错误?

How to fix the xgboost import error in MacOs?

我在 mac 上安装了 xgboost 库,但突然出现 python 错误:ModuleNotFoundError: No module named 'xgboost'

这就是我执行的:

但是,我总是得到以下错误:

你能帮我一下吗?

非常感谢

如果你有包管理器 Anaconda 使用:

conda install -c conda-forge xgboost 

或者:

$ brew install gcc@5
$ pip install xgboost

如果已经安装,请尝试:

pip install --upgrade setuptools

或者:

python -m pip install --upgrade pip
pip install xgboost

或者:

如果您使用的是 pip,请尝试使用 pip3 或 pip2

pip2 install xgboost
pip3 install xgboost

这是您的问题: https://github.com/dmlc/xgboost/issues/3194

简要说明: 从以下位置下载 gboost:

https://github.com/dmlc/xgboost/files/1851733/xgboost-0.7.post5.tar.gz

然后 运行:

pip3 install xgboost-0.7.post5.tar.gz

我无法让任何版本的 XGBoost 在我的 Mac 上运行,即使是上述情况,所以我想分享它在 AWS EC2 Linux 个实例 (https://aws.amazon.com/)。