本文介绍了卸载anaconda后出现Ipython内核错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ubuntu 14.04上。我正在运行anaconda,我使用 conda 命令(根据)使ipython笔记本中的python 2和python 3都可用。但我刚刚卸载了anaconda并在virtualenv中单独安装了ipython,jupyter和notebook。现在,当我尝试创建一个新笔记本时,我收到以下错误。正如你在最后一行中看到的那样,它似乎仍然指的是用anaconda创建的内核,因为我卸载了anaconda后显然不再存在。

I'm on ubuntu 14.04. I was running anaconda and I used the conda command (as per this post) to make both python 2 and python 3 available in ipython notebooks. But I just uninstalled anaconda and installed ipython, jupyter and notebook individually inside a virtualenv. Now when I try to create a new notebook I get the following error. As you can see in the last line, it seems to still be referring to the kernel created with anaconda which obviously doesn't exist anymore since I uninstalled anaconda.

有人可以帮我解决这个问题吗?非常感谢。

Can someone please help me with that issue? Thanks a lot.

 Traceback (most recent call last):
  File "/home/joe/.virtualenvs/crissp/lib/python3.4/site-packages/notebook/base/handlers.py", line 458, in wrapper
    result = yield gen.maybe_future(method(self, *args, **kwargs))
  File "/home/joe/.virtualenvs/crissp/lib/python3.4/site-packages/tornado/gen.py", line 1008, in run
    value = future.result()
  File "/home/joe/.virtualenvs/crissp/lib/python3.4/site-packages/tornado/concurrent.py", line 232, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 3, in raise_exc_info
  File "/home/joe/.virtualenvs/crissp/lib/python3.4/site-packages/tornado/gen.py", line 1014, in run
    yielded = self.gen.throw(*exc_info)
  File "/home/joe/.virtualenvs/crissp/lib/python3.4/site-packages/notebook/services/sessions/handlers.py", line 58, in post
    sm.create_session(path=path, kernel_name=kernel_name))
  File "/home/joe/.virtualenvs/crissp/lib/python3.4/site-packages/tornado/gen.py", line 1008, in run
    value = future.result()
  File "/home/joe/.virtualenvs/crissp/lib/python3.4/site-packages/tornado/concurrent.py", line 232, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 3, in raise_exc_info
  File "/home/joe/.virtualenvs/crissp/lib/python3.4/site-packages/tornado/gen.py", line 1014, in run
    yielded = self.gen.throw(*exc_info)
  File "/home/joe/.virtualenvs/crissp/lib/python3.4/site-packages/notebook/services/sessions/sessionmanager.py", line 73, in create_session
    self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
  File "/home/joe/.virtualenvs/crissp/lib/python3.4/site-packages/tornado/gen.py", line 1008, in run
    value = future.result()
  File "/home/joe/.virtualenvs/crissp/lib/python3.4/site-packages/tornado/concurrent.py", line 232, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 3, in raise_exc_info
  File "/home/joe/.virtualenvs/crissp/lib/python3.4/site-packages/tornado/gen.py", line 282, in wrapper
    yielded = next(result)
  File "/home/joe/.virtualenvs/crissp/lib/python3.4/site-packages/notebook/services/kernels/kernelmanager.py", line 87, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "/home/joe/.virtualenvs/crissp/lib/python3.4/site-packages/jupyter_client/multikernelmanager.py", line 109, in start_kernel
    km.start_kernel(**kwargs)
  File "/home/joe/.virtualenvs/crissp/lib/python3.4/site-packages/jupyter_client/manager.py", line 244, in start_kernel
    **kw)
  File "/home/joe/.virtualenvs/crissp/lib/python3.4/site-packages/jupyter_client/manager.py", line 190, in _launch_kernel
    return launch_kernel(kernel_cmd, **kw)
  File "/home/joe/.virtualenvs/crissp/lib/python3.4/site-packages/jupyter_client/launcher.py", line 123, in launch_kernel
    proc = Popen(cmd, **kwargs)
  File "/usr/lib/python3.4/subprocess.py", line 859, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.4/subprocess.py", line 1457, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: '/home/joe/anaconda3/envs/py27/bin/python'


推荐答案

运行 jupyter kernelspec list ,它应该告诉你kernelspecs的安装位置。您需要删除现在不正确的文件夹。

Run jupyter kernelspec list, and it should tell you where the kernelspecs were installed to. You'll need to remove the folders that are now incorrect.

或者,使用您现在安装的ipython安装新的kernelspec,如上所述。这将取代已为该版本的Python安装的kernelspec。

Alternatively, install a new kernelspec with the ipython you have now installed, as described in the IPython docs. This will replace the kernelspec that was already installed for that version of Python.

这篇关于卸载anaconda后出现Ipython内核错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 01:09