我使用以下代码在Visual Studio Code的终端中安装xgboost:
py -3 -m venv .venv
.venv\scripts\activate
python -m pip install xgboost
我收到此输出:
> Requirement already satisfied: xgboost in
> c:\users\xxx\.venv\lib\site-packages (0.90) Requirement already
> satisfied: numpy in c:\users\xxx\.venv\lib\site-packages (from
> xgboost) (1.17.3) Requirement already satisfied: scipy in
> c:\users\xxx\.venv\lib\site-packages (from xgboost) (1.3.1)
但是当我想在JupyterNotbook和import xgboost as xgb
中使用xgboost时,出现此错误:
ModuleNotFoundError:没有名为“ xgboost”的模块
我正在Windows中使用Visual Studio Code。
感谢@ycx此问题将通过以下命令解决: