如何解决安装后python XGBoost模块导入失败
我已经使用pip安装了XGBoost库,可以在python命令提示符下访问它,如下所示:
(base) abhishek@abhishek:~$ pip3 install xgboost
Collecting xgboost
Using cached xgboost-1.2.1-py3-none-manylinux2010_x86_64.whl (148.9 MB)
Requirement already satisfied: scipy in ./anaconda3/lib/python3.7/site-packages (from xgboost) (1.5.0)
Requirement already satisfied: numpy in ./anaconda3/lib/python3.7/site-packages (from xgboost) (1.18.5)
Installing collected packages: xgboost
Successfully installed xgboost-1.2.1
(base) abhishek@abhishek:~$ python3
Python 3.7.7 (default,May 7 2020,21:25:33)
[GCC 7.3.0] :: Anaconda,Inc. on linux
Type "help","copyright","credits" or "license" for more information.
>>> import xgboost
>>>
但是,当我尝试运行python文件时,python无法找到已安装的XGBoost模块。
(base) abhishek@abhishek:~$ sudo python3 Downloads/ML_Case_Study/Solution/src/app_service.py
Traceback (most recent call last):
File "Downloads/ML_Case_Study/Solution/src/app_service.py",line 2,in <module>
import xgboost as xgb
ModuleNotFoundError: No module named 'xgboost'
任何可能是导致此问题的根本原因的指针都会帮助您。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。