当前位置:   article > 正文

在Jupyter notebook中开启虚拟环境失败_jupyter创建的虚拟环境没有生效

jupyter创建的虚拟环境没有生效

记录一个小错误

报错如下:

[I 21:22:17.778 NotebookApp] JupyterLab extension loaded from E:\anaconda3\lib\site-packages\jupyterlab
[I 21:22:17.778 NotebookApp] JupyterLab application directory is E:\anaconda3\share\jupyter\lab
[I 21:22:17.780 NotebookApp] Serving notebooks from local directory: E:\Jupyter Notebook\Jupyter Notebook Project
[I 21:22:17.780 NotebookApp] Jupyter Notebook 6.1.4 is running at:
[I 21:22:17.780 NotebookApp] http://localhost:8888/?token=3cb9a7687c473ee862637a014fe6f55f4a295c38ef58c258
[I 21:22:17.781 NotebookApp]  or http://127.0.0.1:8888/?token=3cb9a7687c473ee862637a014fe6f55f4a295c38ef58c258
[I 21:22:17.781 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 21:22:17.867 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///C:/Users/FuJianping/AppData/Roaming/jupyter/runtime/nbserver-5660-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=3cb9a7687c473ee862637a014fe6f55f4a295c38ef58c258
     or http://127.0.0.1:8888/?token=3cb9a7687c473ee862637a014fe6f55f4a295c38ef58c258
[W 21:22:29.764 NotebookApp] delete /Untitled1.ipynb
[I 21:22:36.824 NotebookApp] Creating new notebook in
[I 21:22:37.818 NotebookApp] Kernel started: eeda6917-29fc-40d2-9349-8ced768eb766, name: tf_keras
Traceback (most recent call last):
  File "E:\anaconda3\envs\tf_keras\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "E:\anaconda3\envs\tf_keras\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\ipykernel\connect.py", line 18, in <module>
    import jupyter_client
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\jupyter_client\__init__.py", line 4, in <module>
    from .connect import *
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\jupyter_client\connect.py", line 21, in <module>
    import zmq
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\__init__.py", line 55, in <module>
    from zmq import backend
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
    reraise(*exc_info)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
    raise value
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
    _ns = select_backend(first)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
    mod = __import__(name, fromlist=public_api)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
    from . import (constants, error, message, context,
ImportError: DLL load failed: 找不到指定的模块。
[I 21:22:40.821 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports
Traceback (most recent call last):
  File "E:\anaconda3\envs\tf_keras\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "E:\anaconda3\envs\tf_keras\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\ipykernel\connect.py", line 18, in <module>
    import jupyter_client
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\jupyter_client\__init__.py", line 4, in <module>
    from .connect import *
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\jupyter_client\connect.py", line 21, in <module>
    import zmq
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\__init__.py", line 55, in <module>
    from zmq import backend
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
    reraise(*exc_info)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
    raise value
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
    _ns = select_backend(first)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
    mod = __import__(name, fromlist=public_api)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
    from . import (constants, error, message, context,
ImportError: DLL load failed: 找不到指定的模块。
[I 21:22:43.838 NotebookApp] KernelRestarter: restarting kernel (2/5), new random ports
Traceback (most recent call last):
  File "E:\anaconda3\envs\tf_keras\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "E:\anaconda3\envs\tf_keras\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\ipykernel\connect.py", line 18, in <module>
    import jupyter_client
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\jupyter_client\__init__.py", line 4, in <module>
    from .connect import *
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\jupyter_client\connect.py", line 21, in <module>
    import zmq
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\__init__.py", line 55, in <module>
    from zmq import backend
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
    reraise(*exc_info)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
    raise value
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
    _ns = select_backend(first)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
    mod = __import__(name, fromlist=public_api)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
    from . import (constants, error, message, context,
ImportError: DLL load failed: 找不到指定的模块。
[I 21:22:46.849 NotebookApp] KernelRestarter: restarting kernel (3/5), new random ports
Traceback (most recent call last):
  File "E:\anaconda3\envs\tf_keras\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "E:\anaconda3\envs\tf_keras\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\ipykernel\connect.py", line 18, in <module>
    import jupyter_client
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\jupyter_client\__init__.py", line 4, in <module>
    from .connect import *
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\jupyter_client\connect.py", line 21, in <module>
    import zmq
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\__init__.py", line 55, in <module>
    from zmq import backend
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
    reraise(*exc_info)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
    raise value
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
    _ns = select_backend(first)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
    mod = __import__(name, fromlist=public_api)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
    from . import (constants, error, message, context,
ImportError: DLL load failed: 找不到指定的模块。
[I 21:22:49.860 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
Traceback (most recent call last):
  File "E:\anaconda3\envs\tf_keras\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "E:\anaconda3\envs\tf_keras\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\ipykernel\connect.py", line 18, in <module>
    import jupyter_client
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\jupyter_client\__init__.py", line 4, in <module>
    from .connect import *
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\jupyter_client\connect.py", line 21, in <module>
    import zmq
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\__init__.py", line 55, in <module>
    from zmq import backend
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
    reraise(*exc_info)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
    raise value
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
    _ns = select_backend(first)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
    mod = __import__(name, fromlist=public_api)
  File "E:\anaconda3\envs\tf_keras\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
    from . import (constants, error, message, context,
ImportError: DLL load failed: 找不到指定的模块。
[W 21:22:52.869 NotebookApp] KernelRestarter: restart failed
[W 21:22:52.869 NotebookApp] Kernel eeda6917-29fc-40d2-9349-8ced768eb766 died, removing from map.
[W 21:23:37.835 NotebookApp] Timeout waiting for kernel_info reply from eeda6917-29fc-40d2-9349-8ced768eb766
[E 21:23:37.836 NotebookApp] Error opening stream: HTTP 404: Not Found (Kernel does not exist: eeda6917-29fc-40d2-9349-8ced768eb766)

 

原因是没有在该虚拟环境中安装 jupyter

所以,解决方法就是在该虚拟环境中输入命令: conda install jupyter

然后回车

会告诉你需要安装一系列的包,y/n,输入 y 并回车即可,

安装完成后,找到电脑“开始”除点击“Anaconda"下的 ”Jupyter Notebook (你的虚拟环境的名称)“并点击即可进入你的虚拟环境中。
 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/197813
推荐阅读
相关标签
  

闽ICP备14008679号