无法使用Jupyter Lab或Jupyter Notebook运行任何ipynb文件(FileNotFoundError:[WinError 2]系统找不到指定的文件)

时间:2018-06-04 18:56:35

标签: python jupyter-notebook

我在Win10上运行JupyterLab / JupyterNotebook,在Windows 10上运行Python和PyCharm。每当我启动JupyterLab / JupyterNotebook时,我都会收到下面所述的错误。我已经尝试重新安装Anaconda-distribution或任何其他Python实例,但每次启动JupyterLab / Notebook时它都会给我同样的错误。我也试过在Win 7的远程服务器上运行它,但它给了我完全相同的错误。我的一部分认为我在安装Anaconda,Python和PyCharm时犯了同样的错误,现在我无法将其还原。有什么建议吗?

Traceback (most recent call last):
  File "E:\anaconda3\lib\site-packages\tornado\web.py", line 1543, in _execute
    result = yield result
  File "E:\anaconda3\lib\site-packages\tornado\gen.py", line 1099, in run
    value = future.result()
  File "E:\anaconda3\lib\site-packages\tornado\gen.py", line 1107, in run
    yielded = self.gen.throw(*exc_info)
  File "E:\anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 73, in post
    type=mtype))
  File "E:\anaconda3\lib\site-packages\tornado\gen.py", line 1099, in run
    value = future.result()
  File "E:\anaconda3\lib\site-packages\tornado\gen.py", line 1107, in run
    yielded = self.gen.throw(*exc_info)
  File "E:\anaconda3\lib\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 "E:\anaconda3\lib\site-packages\tornado\gen.py", line 1099, in run
    value = future.result()
  File "E:\anaconda3\lib\site-packages\tornado\gen.py", line 1107, in run
    yielded = self.gen.throw(*exc_info)
  File "E:\anaconda3\lib\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 "E:\anaconda3\lib\site-packages\tornado\gen.py", line 1099, in run
    value = future.result()
  File "E:\anaconda3\lib\site-packages\tornado\gen.py", line 315, in wrapper
    yielded = next(result)
  File "E:\anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 148, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "E:\anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
    km.start_kernel(**kwargs)
  File "E:\anaconda3\lib\site-packages\jupyter_client\manager.py", line 259, in start_kernel
    **kw)
  File "E:\anaconda3\lib\site-packages\jupyter_client\manager.py", line 204, in _launch_kernel
    return launch_kernel(kernel_cmd, **kw)
  File "E:\anaconda3\lib\site-packages\jupyter_client\launcher.py", line 128, in launch_kernel
    proc = Popen(cmd, **kwargs)
  File "E:\anaconda3\lib\subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "E:\anaconda3\lib\subprocess.py", line 997, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

5 个答案:

答案 0 :(得分:2)

它似乎与nb_conda有关。一旦我使用下面的命令重新安装nb_conda,它对我有用。

conda install nb_conda

答案 1 :(得分:1)

我有完全一样的问题。我找到了解决方法here(请单击链接以获得进一步的解释),方法是在我的虚拟环境中的cmd中键入此问题,从而解决了问题:

python -m ipykernel install --user

我希望它将对您有帮助

答案 2 :(得分:0)

原因很多。但您可以尝试按以下命令重新安装jupyter:

  

pip install --upgrade pip

     

pip install jupyter

然后运行jupyter

  

jupyter笔记本

这个问题一旦发生在我身上,我通过运行Anaconda提示符的上述推荐将其整理出来。在执行此操作之前,您可能需要升级pip。

答案 3 :(得分:0)

可能是因为您删除了一个环境,但仍然有对该环境的引用。要解决此问题,请在命令提示符处运行以下命令:

python -m ipykernel install --user

希望这会有所帮助:)

答案 4 :(得分:0)

来自Github

https://github.com/jupyter/notebook/issues/4079#issuecomment-429475420


转到目录:/ python / share / jupyter / kernels / 打开文件“ kernel.json”,然后设置“ argv”:例如python路径。

{
"argv": [
"C:\Anaconda3\python.exe",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "Python 3",
"language": "python"
}

启动jupyter笔记本。现在一切都很好。