我的操作系统是Ubuntu,我已经按照官方安装的guide安装了lightgbm。但是,当我导入它时,出现以下错误:ImportError:没有名为lightgbm的模块
我怎么才能解决这个问题?
在运行完那些Linux命令行之后,我是否还需要转到/python-Package文件夹来运行setup.py?
balp4ylt1#
我遇到了同样的问题,并解决了直接在笔记本上运行安装程序的问题
!pip install lightgbm
3qpi33ja2#
除了运行那些Linux命令行之外。我还需要转到/python-package,然后运行‘python setup.py安装’。
/python-package
mkh04yzy3#
conda install -c conda-forge lightgbm为我解决了导入前只需在笔记本单元中运行的问题
conda install -c conda-forge lightgbm
uyhoqukh4#
对于Windows用户,如果未安装Visual Studio(2015或2017),则需要VC runtime <https://go.microsoft.com/fwlink/?LinkId=746572>。
VC runtime <https://go.microsoft.com/fwlink/?LinkId=746572>
首先通过pip install wheel安装wheel <http://pythonwheels.com>。之后,下载轮子文件并从其安装:
pip install wheel
wheel <http://pythonwheels.com>
pip install lightgbm
w80xi6nr5#
感谢您的上述问题和答案,有类似的问题。
问题:
成功安装lightgbm后,我收到错误ImportError: No module named 'lightgbm'(在AI平台项目中Google Cloud的Notebook示例上的Jupyter Notebook中)。
lightgbm
ImportError: No module named 'lightgbm'
已意识到即使笔记本在Python 3(路径:‘./.local/lib/python2.7/site-packages’)中运行,lightgbm的安装也在Python 2.7中。
Python 3
./.local/lib/python2.7/site-packages
Python 2.7
解决方案:
将Jupyter笔记本设置为在Python2上运行而不是在Python3上运行后,该错误已消除。
5条答案
按热度按时间balp4ylt1#
我遇到了同样的问题,并解决了直接在笔记本上运行安装程序的问题
3qpi33ja2#
除了运行那些Linux命令行之外。我还需要转到
/python-package
,然后运行‘python setup.py安装’。mkh04yzy3#
conda install -c conda-forge lightgbm
为我解决了导入前只需在笔记本单元中运行的问题uyhoqukh4#
对于Windows用户,如果未安装Visual Studio(2015或2017),则需要
VC runtime <https://go.microsoft.com/fwlink/?LinkId=746572>
。首先通过
pip install wheel
安装wheel <http://pythonwheels.com>
。之后,下载轮子文件并从其安装:w80xi6nr5#
感谢您的上述问题和答案,有类似的问题。
问题:
成功安装
lightgbm
后,我收到错误ImportError: No module named 'lightgbm'
(在AI平台项目中Google Cloud的Notebook示例上的Jupyter Notebook中)。问题:
已意识到即使笔记本在
Python 3
(路径:‘./.local/lib/python2.7/site-packages
’)中运行,lightgbm
的安装也在Python 2.7
中。解决方案:
将Jupyter笔记本设置为在Python2上运行而不是在Python3上运行后,该错误已消除。