0

我希望有人能帮助我理解为什么 JupyterLab 无法在我的系统上启动内核。

背景

我正在开发 macOS High Sierra。我曾经通过 Mac OS 安装程序在我的主文件夹 ( $HOME/anaconda) 的默认位置安装 Anaconda。基于这个线程,我卸载了 Anaconda。

我从 Homebrew Cask 重新安装了 Anaconda(放在export PATH=/usr/local/anaconda3/bin:"$PATH"我的.bashrc.

问题

现在当我

  • 运行jupyter-lab
  • 创建一个新笔记本,并且
  • 选择一个 Python 3 内核,

该过程失败,输出如下:

Traceback (most recent call last): File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/web.py", line 1543, in _execute result = yield result File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run value = future.result() File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run yielded = self.gen.throw(*exc_info) File "/usr/local/anaconda3/lib/python3.6/site-packages/notebook/services/sessions/handlers.py", line 73, in post type=mtype)) File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run value = future.result() File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run yielded = self.gen.throw(*exc_info) File "/usr/local/anaconda3/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 79, in create_session kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name) File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run value = future.result() File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run yielded = self.gen.throw(*exc_info) File "/usr/local/anaconda3/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 92, in start_kernel_for_session self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name) File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run value = future.result() File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 315, in wrapper yielded = next(result) File "/usr/local/anaconda3/lib/python3.6/site-packages/notebook/services/kernels/kernelmanager.py", line 148, in start_kernel super(MappingKernelManager, self).start_kernel(**kwargs) File "/usr/local/anaconda3/lib/python3.6/site-packages/jupyter_client/multikernelmanager.py", line 110, in start_kernel km.start_kernel(**kwargs) File "/usr/local/anaconda3/lib/python3.6/site-packages/jupyter_client/manager.py", line 259, in start_kernel **kw) File "/usr/local/anaconda3/lib/python3.6/site-packages/jupyter_client/manager.py", line 204, in _launch_kernel return launch_kernel(kernel_cmd, **kw) File "/usr/local/anaconda3/lib/python3.6/site-packages/jupyter_client/launcher.py", line 128, in launch_kernel proc = Popen(cmd, **kwargs) File "/usr/local/anaconda3/lib/python3.6/subprocess.py", line 709, in __init__ restore_signals, start_new_session) File "/usr/local/anaconda3/lib/python3.6/subprocess.py", line 1344, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: '~/anaconda/bin/python': '~/anaconda/bin/python'

我已经从我的环境 ( , ) 中删除了对$HOME/anaconda(我的旧安装位置)的所有引用,所以我无法确定引用的位置。.bashrc.bash_profile

任何建议将不胜感激。

4

1 回答 1

0

这个问题在Jupyter 项目的这个 GitHub 线程中得到了回答。基本解决方案:

  • 运行jupyter kernelspec list以查看它是否指向正确的 Python 安装
    • 如果没有,请删除该文件夹~/Library/Jupyter
    • 重新运行jupyter kernelspec list

这应该重建目录并给出类似的输出

Available kernels: python3 /usr/local/anaconda3/share/jupyter/kernels/python3

这是安装 Anaconda 的 Homebrew 的正确位置。

于 2018-04-13T13:15:37.857 回答