简体   繁体   English

ImportError:没有名为“ xgboost”的模块

[英]ImportError: No module named 'xgboost'

This 这个

import sys
from platform import python_version

print(sys.base_prefix)
print(python_version())

outputs this: 输出此:

 /home/hp/anaconda3/envs/tensorflow
 3.5.4

I tried to install it with the following commands: 我尝试使用以下命令进行安装:

conda install py-xgboost

and

conda install -c conda-forge xgboost

Each time I am getting this error: 每次我收到此错误:

ImportError: No module named 'xgboost'

OS: OS:

Ubuntu 16.04

Although your second attempt should work, your first attempt doesn't look right; 尽管您的第二次尝试应该可以,但是您的第一次尝试看起来并不正确。 as per the documentation , you should use 根据文档 ,您应该使用

conda install -c anaconda py-xgboost

after you have activated the respective environment where you want the package installed. 在激活要安装软件包的相应环境之后。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM