ImportError: DLL load failed while importing _ssl: 找不到指定的模块 No module named ‘jupyter_server‘

问题描述

  • Windows10 下使用
    ImportError: DLL load failed while importing _ssl: 找不到指定的模块 No module named ‘jupyter_server‘_第1张图片
Traceback (most recent call last):
  File "C:\Users\xxx\Anaconda3\lib\site-packages\jupyterlab_server\server.py", line 14, in <module>
    from notebook.base.handlers import (
  File "C:\Users\xxx\Anaconda3\lib\site-packages\notebook\base\handlers.py", line 22, in <module>
    from tornado import web, gen, escape, httputil
  File "C:\Users\xxx\Anaconda3\lib\site-packages\tornado\web.py", line 87, in <module>
    from tornado.httpserver import HTTPServer
  File "C:\Users\xxx\Anaconda3\lib\site-packages\tornado\httpserver.py", line 29, in <module>
    import ssl
  File "C:\Users\xxx\Anaconda3\lib\ssl.py", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: DLL load failed while importing _ssl: 找不到指定的模块。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\xxx\Anaconda3\Scripts\jupyter-lab-script.py", line 5, in <module>
    from jupyterlab.labapp import main
  File "C:\Users\xxx\Anaconda3\lib\site-packages\jupyterlab\labapp.py", line 14, in <module>
    from jupyterlab_server import slugify, WORKSPACE_EXTENSION
  File "C:\Users\xxx\Anaconda3\lib\site-packages\jupyterlab_server\__init__.py", line 4, in <module>
    from .app import LabServerApp
  File "C:\Users\xxx\Anaconda3\lib\site-packages\jupyterlab_server\app.py", line 9, in <module>
    from .server import ServerApp
  File "C:\Users\xxx\Anaconda3\lib\site-packages\jupyterlab_server\server.py", line 26, in <module>
    from jupyter_server.base.handlers import (                          # noqa
ModuleNotFoundError: No module named 'jupyter_server'

原因分析

  • Anaconda 路径 C:\Users\username\Anaconda3\Library\bin 没有添加到 Windows 系统环境变量中

解决方法

  • 在 Windows 环境变量中添加如下三项:
C:\Users\username\Anaconda3
C:\Users\username\Anaconda3\Scripts
C:\Users\username\Anaconda3\Library\bin
  • 注意:如果 Anaconda 不是安装在默认目录下,需要把 C:\Users\username 路径替换为自己安装 Anaconda 的路径

  • PS:Windows 环境变量配置可参考:打开【文件资源管理器】,右击左侧的【此电脑】–【属性】–【高级系统设置】–【环境变量】–【系统变量】–【Path】项,添加上面三项内容即可,任何一项没有添加都会出现问题
    ImportError: DLL load failed while importing _ssl: 找不到指定的模块 No module named ‘jupyter_server‘_第2张图片

你可能感兴趣的:(Python)