Sagemaker笔记本电脑上的xgboost导入失败 [英] xgboost on Sagemaker notebook import fails

查看:108
本文介绍了Sagemaker笔记本电脑上的xgboost导入失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Sagemaker笔记本电脑上使用XGBoost.

I am trying to use XGBoost on Sagemaker notebook.

我正在使用conda_python3内核,并安装了以下软件包:

I am using conda_python3 kernel, and the following packages are installed:

  • py-xgboost-mutex
  • libxgboost
  • py-xgboost
  • py-xgboost-gpu

但是一旦我尝试导入xgboost,导入就会失败:

But once I am trying to import xgboost it fails on import:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-5-5943d1bfe3f1> in <module>()
----> 1 import xgboost as xgb

ModuleNotFoundError: No module named 'xgboost'

推荐答案

在Sagemaker笔记本中,请执行以下步骤

In Sagemaker notebooks use the below steps

i)!type python3

ii)说上面的是/home/ec2-user/anaconda3/envs/python3/bin/python3为您提供

ii) Say the above is /home/ec2-user/anaconda3/envs/python3/bin/python3 for you

iii)!/home/ec2-user/anaconda3/envs/python3/bin/python3 -m pip install xgboost

iv)import xgboost

i)conda activate conda_python3
ii)pip install xgboost

i) conda activate conda_python3
ii) pip install xgboost

免责声明:有时安装会因gcc版本而失败,在这种情况下,请在运行install之前更新pip版本

Disclaimer : sometimes the installation would fail with gcc version ,in that case update pip version before running install

这篇关于Sagemaker笔记本电脑上的xgboost导入失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆