[英]LightGBM and Catboost are both installed but give ModuleNotFoundError when imported in Jupyter
I have successfully installed the CatBoost and LightGbM modules using the command prompt. 我已经使用命令提示符成功安装了CatBoost和LightGbM模块。 It gave me the message Successfully installed catboost-0.2.5 (I also previously tried another one).
它给了我消息成功安装catboost-0.2.5(我之前也尝试过另一个)。 However, for both of them I have an identical error when I try to import both of them in a jupyter notebook:
但是,当我尝试将它们都导入到jupyter笔记本中时,对于它们两个,我都会遇到相同的错误:
import lightgbm as lgb
I get: 我得到:
ModuleNotFoundError: No module named 'lightgbm'
and I get an identical error with CatBoost as well. 而且CatBoost也会出现相同的错误。
Any ideas? 有任何想法吗? Thank you!
谢谢!
As discussed in the chat , it turns out that the environment where your Jupyter notebooks run and the one where you have installed the packages are different. 如聊天中所讨论的,事实证明Jupyter笔记本运行的环境与安装软件包的环境不同。
Since pip
reports both packages installed in your "main" environment (ie the one coming up when you simply open a Windows command prompt), what you should do is open Jupyter from the command prompt, as 由于
pip
报告了两个安装在“主”环境中的软件包(即,仅在打开Windows命令提示符时就会出现的软件包),因此您应该从命令提示符处打开Jupyter,如下所示:
jupyter notebook
and your packages will indeed be available for importing, as we confirmed indeed. 正如我们确认的那样,您的软件包确实可以导入。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.