首页 > 解决方案 > Anaconda 内核未连接

问题描述

我试图在 anaconda 中解决一段时间的连接问题。尝试多次重新安装 anaconda 并创建了新环境。一切都很好,突然之间就开始了。我在虚拟盒中安装了 Ubuntu,并在其中安装了 anaconda。它在那里工作得很好,我在 Windows 中遇到了这个问题。spyder ide 也有同样的问题。当我在命令提示符下执行 jupyter notebook 命令时,我得到了这个:

Microsoft Windows [Version 10.0.18363.720]
(c) 2019 Microsoft Corporation. All rights reserved.

    C:\Users\staff>jupyter notebook
    Traceback (most recent call last):
      File "C:\Users\staff\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
        from notebook.notebookapp import main
      File "C:\Users\staff\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 62, in <module>
        from tornado import httpserver
      File "C:\Users\staff\Anaconda3\lib\site-packages\tornado\httpserver.py", line 29, in <module>
        import ssl
      File "C:\Users\staff\Anaconda3\lib\ssl.py", line 98, in <module>
        import _ssl             # if we can't import it, let the error propagate
    ImportError: DLL load failed: The specified procedure could not be found.

    C:\Users\staff>


    ```This is the error shown in anaconda.

    [I 21:05:44.361 NotebookApp] JupyterLab extension loaded from C:\Users\staff\Anaconda3\lib\site-packages\jupyterlab
    [I 21:05:44.361 NotebookApp] JupyterLab application directory is C:\Users\staff\Anaconda3\share\jupyter\lab
    [I 21:05:44.363 NotebookApp] Serving notebooks from local directory: C:\Users\staff
    [I 21:05:44.363 NotebookApp] The Jupyter Notebook is running at:
    [I 21:05:44.363 NotebookApp] http://localhost:8888/?token=54700b487e16d9ed49744f47f227432ed7c3e4603104bdb7
    [I 21:05:44.363 NotebookApp] or http://127.0.0.1:8888/?token=54700b487e16d9ed49744f47f227432ed7c3e4603104bdb7
    [I 21:05:44.363 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
    [C 21:05:44.420 NotebookApp] 

    To access the notebook, open this file in a browser:
    file:///C:/Users/staff/AppData/Roaming/jupyter/runtime/nbserver-6256-open.html
    Or copy and paste one of these URLs:
    http://localhost:8888/?token=54700b487e16d9ed49744f47f227432ed7c3e4603104bdb7
    or http://127.0.0.1:8888/?token=54700b487e16d9ed49744f47f227432ed7c3e4603104bdb7
    [I 21:05:51.573 NotebookApp] Creating new notebook in 
    [I 21:05:52.961 NotebookApp] Kernel started: dfcdafa1-2271-49ee-b69f-266ac5973745
    Traceback (most recent call last):
    File "C:\Users\staff\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
    File "C:\Users\staff\Anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
    File "C:\Users\staff\Anaconda3\lib\site-packages\ipykernel_launcher.py", line 15, in 
    from ipykernel import kernelapp as app
    File "C:\Users\staff\Anaconda3\lib\site-packages\ipykernel\__init__.py", line 2, in 
    from .connect import *
    File "C:\Users\staff\Anaconda3\lib\site-packages\ipykernel\connect.py", line 13, in 
    from IPython.core.profiledir import ProfileDir
    File "C:\Users\staff\Anaconda3\lib\site-packages\IPython\__init__.py", line 54, in 
    from .core.application import Application
    File "C:\Users\staff\Anaconda3\lib\site-packages\IPython\core\application.py", line 25, in 
    from IPython.core import release, crashhandler
    File "C:\Users\staff\Anaconda3\lib\site-packages\IPython\core\crashhandler.py", line 27, in 
    from IPython.core import ultratb
    File "C:\Users\staff\Anaconda3\lib\site-packages\IPython\core\ultratb.py", line 115, in 
    from IPython.core import debugger
    File "C:\Users\staff\Anaconda3\lib\site-packages\IPython\core\debugger.py", line 47, in 
    from pdb import Pdb as OldPdb
    File "C:\Users\staff\Anaconda3\lib\pdb.py", line 76, in 
    import code
    File "C:\Users\staff\code.py", line 5
    from cryptography.hazmat.backends import 
    ^
    SyntaxError: invalid syntax
    [I 21:05:55.962 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports
    Traceback (most recent call last):
    File "C:\Users\staff\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
    File "C:\Users\staff\Anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
    File "C:\Users\staff\Anaconda3\lib\site-packages\ipykernel_launcher.py", line 15, in 
    from ipykernel import kernelapp as app
    File "C:\Users\staff\Anaconda3\lib\site-packages\ipykernel\__init__.py", line 2, in 
    from .connect import *
    File "C:\Users\staff\Anaconda3\lib\site-packages\ipykernel\connect.py", line 13, in 
    from IPython.core.profiledir import ProfileDir
    File "C:\Users\staff\Anaconda3\lib\site-packages\IPython\__init__.py", line 54, in 
    from .core.application import Application
    File "C:\Users\staff\Anaconda3\lib\site-packages\IPython\core\application.py", line 25, in 
    from IPython.core import release, crashhandler
    File "C:\Users\staff\Anaconda3\lib\site-packages\IPython\core\crashhandler.py", line 27, in 
    from IPython.core import ultratb
    File "C:\Users\staff\Anaconda3\lib\site-packages\IPython\core\ultratb.py", line 115, in 
    from IPython.core import debugger
    File "C:\Users\staff\Anaconda3\lib\site-packages\IPython\core\debugger.py", line 47, in 
    from pdb import Pdb as OldPdb
    File "C:\Users\staff\Anaconda3\lib\pdb.py", line 76, in 
    import code
    File "C:\Users\staff\code.py", line 5
    from cryptography.hazmat.backends import 
    ^
    SyntaxError: invalid syntax


标签: pythonjupyter-notebookanacondaspyder

解决方案


推荐阅读