问题描述
jupyter打开后闪退,什么都没提示。然后使用Anaconda prompt 运行指令jupyter notebook,可以发现出现如下错误:
(base) C:\Users\XuHR>jupyter notebook
Traceback (most recent call last):
File "C:\Users\XuHR\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "C:\Users\XuHR\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 81, in <module>
from .services.kernels.kernelmanager import MappingKernelManager
File "C:\Users\XuHR\Anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 19, in <module>
from jupyter_client.session import Session
File "C:\Users\XuHR\AppData\Roaming\Python\Python37\site-packages\jupyter_client\__init__.py", line 4, in <module>
from .connect import *
File "C:\Users\XuHR\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 32, in <module>
from jupyter_core.paths import jupyter_data_dir, jupyter_runtime_dir, secure_write
ImportError: cannot import name 'secure_write' from 'jupyter_core.paths' (C:\Users\XuHR\Anaconda3\lib\site-packages\jupyter_core\paths.py)
解决方案
直接在Anaconda prompt运行指令 pip install --upgrade jupyter_core jupyter_client 即可。
然后再输入jupyter notebook既可打开。或者从快捷选项中打开