Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 我已成功安装lightgbm,但可以';不要在jupyter跑步_Python_Macos_Terminal_Jupyter Notebook - Fatal编程技术网

Python 我已成功安装lightgbm,但可以';不要在jupyter跑步

Python 我已成功安装lightgbm,但可以';不要在jupyter跑步,python,macos,terminal,jupyter-notebook,Python,Macos,Terminal,Jupyter Notebook,我使用anaconda运行jupyter,路径为: /Users/Kum/anaconda/bin 我已在以下路径下成功安装lightgbm: drwxr-xr-x 22 Kum staff 748B Feb 11 09:11 LightGBM -rwxr-xr-x 1 Kum staff 147B Jun 16 2016 ipython -rwxr-xr-x 1 Kum staff 147B Jun 16 2016 ipython2 -rwxr-xr-x

我使用anaconda运行jupyter,路径为:

/Users/Kum/anaconda/bin
我已在以下路径下成功安装lightgbm:

drwxr-xr-x  22 Kum  staff   748B Feb 11 09:11 LightGBM
-rwxr-xr-x   1 Kum  staff   147B Jun 16  2016 ipython
-rwxr-xr-x   1 Kum  staff   147B Jun 16  2016 ipython2
-rwxr-xr-x   1 Kum  staff    11K Jun 16  2016 isympy
-rwxr-xr-x   1 Kum  staff   133B Jun 16  2016 jsonschema
-rwxr-xr-x   1 Kum  staff   149B Jun 16  2016 jupyter
-rwxr-xr-x   1 Kum  staff   108B Jun 16  2016 jupyter-console
-rwxr-xr-x   1 Kum  staff   176B Jun 16  2016 jupyter-kernelspec
-rwxr-xr-x   1 Kum  staff   159B Jun 16  2016 jupyter-migrate
-rwxrwxr-x   1 Kum  staff   113B Jun 16  2016 jupyter-nbconvert
-rwxr-xr-x   1 Kum  staff   152B Jun 16  2016 jupyter-nbextension
-rwxr-xr-x   1 Kum  staff   150B Jun 16  2016 jupyter-notebook
在LightGBM下:

-rw-r--r--   1 Kum  staff   3.1K Feb 11 09:10 CMakeLists.txt
-rw-r--r--   1 Kum  staff   1.1K Feb 11 09:10 LICENSE
drwxr-xr-x  12 Kum  staff   408B Feb 11 09:10 R-package
-rw-r--r--   1 Kum  staff   3.9K Feb 11 09:10 README.md
drwxr-xr-x   6 Kum  staff   204B Feb 11 09:11 build
drwxr-xr-x   4 Kum  staff   136B Feb 11 09:10 docker
drwxr-xr-x  12 Kum  staff   408B Feb 11 09:10 docs
drwxr-xr-x  10 Kum  staff   340B Feb 11 09:10 examples
drwxr-xr-x   3 Kum  staff   102B Feb 11 09:10 include
-rwxr-xr-x   1 Kum  staff   1.0M Feb 11 09:11 lib_lightgbm.so
-rwxr-xr-x   1 Kum  staff   982K Feb 11 09:11 lightgbm
drwxr-xr-x   4 Kum  staff   136B Feb 11 09:10 pmml
drwxr-xr-x   8 Kum  staff   272B Feb 11 10:19 python-package
drwxr-xr-x  11 Kum  staff   374B Feb 11 09:10 src
drwxr-xr-x   4 Kum  staff   136B Feb 11 09:10 tests
drwxr-xr-x   5 Kum  staff   170B Feb 11 09:10 windows

anaconda/bin/LightGBM  master ✔
当我编写代码时:

import lightgbm as lgm
出现错误:

ImportError: No module named lightgbm

如何解决这个问题……我很难过。XD

确保你通过了检查。然后尝试
conda list
检查
lightgbm
是否在已安装的软件包列表中

如果未使用
conda
pip
安装模块,则模块可能未添加到python路径

您可以在Python会话开始时通过修改env手动配置它,或者使用模块目录下的jupyter notebook/Python。

根据lightgbm中显示的要求在conda中创建一个新环境,然后在jupyter中创建一个环境列表,并通过在内核设置中更改来根据您的包使用它将正常工作

如何创建新环境

另外,根据32位或64位下载lightgbm 64位用于:

config --env --set subdir win--64
并在此处激活特定环境,即py37_64,因此命令将为:

activate py37_64
并安装lightgbm:

 pip install lightgbm
现在看看魔法,在你的jupyter笔记本中使用这个环境

conda install nb_conda
要在笔记本中使用此内核,您必须停用env并再次激活它

现在看看你的笔记本


在这里你可以看到,在图片中,我正在使用它,现在你可以根据需要切换内核。

是的。我检查了路径并解决了问题。Thx。我没有将包放在正确的路径中。我的mac中有两个python版本@新席在蟒蛇中使用斯皮德。我应该把lightgbm包放在Spyder文件夹中吗?
conda install nb_conda