更改Jupyter Notebook的起始目录后,内核将停止工作

时间:2019-09-16 11:26:12

标签: directory jupyter-notebook kernel ipython

我在C驱动器中安装了anaconda。 Jupyter在C驱动器中打开。但是我所有的文件都在G盘中。所以我通过修改配置文件更改了起始目录。现在jupyter在G驱动器中打开,但是内核不再起作用。它说找不到内核。

这是针对运行Jupyter版本5.7.8的Anaconda 3 内核可以连接旧笔记本,并且工作正常,但似乎不能连接新笔记本。 尝试通过删除通过kernelspec列表找到的内核来重置为默认内核。 尝试了用于更改目录的替代方法,一切似乎都可以很好地更改目录,但是内核问题仍然存在。 只要im在默认的C驱动器中,内核也可以正常工作

(base) C:\Users\91949>jupyter notebook
[I 16:52:33.764 NotebookApp] The port 8888 is already in use, trying another port.
[I 16:52:33.765 NotebookApp] The port 8889 is already in use, trying another port.
[I 16:52:33.766 NotebookApp] The port 8890 is already in use, trying another port.
[I 16:52:33.830 NotebookApp] JupyterLab extension loaded from C:\Users\91949\Anaconda3\lib\site-packages\jupyterlab
[I 16:52:33.830 NotebookApp] JupyterLab application directory is C:\Users\91949\Anaconda3\share\jupyter\lab
[I 16:52:33.833 NotebookApp] Serving notebooks from local directory: G:/Py
[I 16:52:33.833 NotebookApp] The Jupyter Notebook is running at:
[I 16:52:33.833 NotebookApp] http://localhost:8891/?token=1a78f815fbc19c027143f4bc8976b755dcb3e26098724bda
[I 16:52:33.833 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 16:52:33.973 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///C:/Users/91949/AppData/Roaming/jupyter/runtime/nbserver-1324-open.html
    Or copy and paste one of these URLs:
        http://localhost:8891/?token=1a78f815fbc19c027143f4bc8976b755dcb3e26098724bda
[I 16:52:42.375 NotebookApp] Kernel started: aed55e95-532a-40e6-8d50-71d53ce9016b
Traceback (most recent call last):
  File "C:\Users\91949\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\91949\Anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipykernel\connect.py", line 13, in <module>
    from IPython.core.profiledir import ProfileDir
  File "C:\Users\91949\Anaconda3\lib\site-packages\IPython\__init__.py", line 54, in <module>
    from .core.application import Application
  File "C:\Users\91949\Anaconda3\lib\site-packages\IPython\core\application.py", line 23, in <module>
    from traitlets.config.application import Application, catch_config_error
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\__init__.py", line 6, in <module>
    from .application import *
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\application.py", line 19, in <module>
    from traitlets.config.configurable import Configurable, SingletonConfigurable
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\configurable.py", line 12, in <module>
    from .loader import Config, LazyConfigValue, _is_section_key
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\loader.py", line 16, in <module>
    from ipython_genutils.path import filefind
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipython_genutils\path.py", line 13, in <module>
    import random
  File "G:\Py\random.py", line 3, in <module>
    print(random.randint(20,30))
AttributeError: module 'random' has no attribute 'randint'
[I 16:52:45.349 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports
Traceback (most recent call last):
  File "C:\Users\91949\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\91949\Anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipykernel\connect.py", line 13, in <module>
    from IPython.core.profiledir import ProfileDir
  File "C:\Users\91949\Anaconda3\lib\site-packages\IPython\__init__.py", line 54, in <module>
    from .core.application import Application
  File "C:\Users\91949\Anaconda3\lib\site-packages\IPython\core\application.py", line 23, in <module>
    from traitlets.config.application import Application, catch_config_error
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\__init__.py", line 6, in <module>
    from .application import *
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\application.py", line 19, in <module>
    from traitlets.config.configurable import Configurable, SingletonConfigurable
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\configurable.py", line 12, in <module>
    from .loader import Config, LazyConfigValue, _is_section_key
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\loader.py", line 16, in <module>
    from ipython_genutils.path import filefind
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipython_genutils\path.py", line 13, in <module>
    import random
  File "G:\Py\random.py", line 3, in <module>
    print(random.randint(20,30))
AttributeError: module 'random' has no attribute 'randint'
[I 16:52:48.415 NotebookApp] KernelRestarter: restarting kernel (2/5), new random ports
Traceback (most recent call last):
  File "C:\Users\91949\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\91949\Anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipykernel\connect.py", line 13, in <module>
    from IPython.core.profiledir import ProfileDir
  File "C:\Users\91949\Anaconda3\lib\site-packages\IPython\__init__.py", line 54, in <module>
    from .core.application import Application
  File "C:\Users\91949\Anaconda3\lib\site-packages\IPython\core\application.py", line 23, in <module>
    from traitlets.config.application import Application, catch_config_error
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\__init__.py", line 6, in <module>
    from .application import *
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\application.py", line 19, in <module>
    from traitlets.config.configurable import Configurable, SingletonConfigurable
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\configurable.py", line 12, in <module>
    from .loader import Config, LazyConfigValue, _is_section_key
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\loader.py", line 16, in <module>
    from ipython_genutils.path import filefind
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipython_genutils\path.py", line 13, in <module>
    import random
  File "G:\Py\random.py", line 3, in <module>
    print(random.randint(20,30))
AttributeError: module 'random' has no attribute 'randint'
[I 16:52:51.490 NotebookApp] KernelRestarter: restarting kernel (3/5), new random ports
Traceback (most recent call last):
  File "C:\Users\91949\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\91949\Anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipykernel\connect.py", line 13, in <module>
    from IPython.core.profiledir import ProfileDir
  File "C:\Users\91949\Anaconda3\lib\site-packages\IPython\__init__.py", line 54, in <module>
    from .core.application import Application
  File "C:\Users\91949\Anaconda3\lib\site-packages\IPython\core\application.py", line 23, in <module>
    from traitlets.config.application import Application, catch_config_error
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\__init__.py", line 6, in <module>
    from .application import *
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\application.py", line 19, in <module>
    from traitlets.config.configurable import Configurable, SingletonConfigurable
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\configurable.py", line 12, in <module>
    from .loader import Config, LazyConfigValue, _is_section_key
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\loader.py", line 16, in <module>
    from ipython_genutils.path import filefind
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipython_genutils\path.py", line 13, in <module>
    import random
  File "G:\Py\random.py", line 3, in <module>
    print(random.randint(20,30))
AttributeError: module 'random' has no attribute 'randint'
[I 16:52:54.548 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
Traceback (most recent call last):
  File "C:\Users\91949\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\91949\Anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipykernel\connect.py", line 13, in <module>
    from IPython.core.profiledir import ProfileDir
  File "C:\Users\91949\Anaconda3\lib\site-packages\IPython\__init__.py", line 54, in <module>
    from .core.application import Application
  File "C:\Users\91949\Anaconda3\lib\site-packages\IPython\core\application.py", line 23, in <module>
    from traitlets.config.application import Application, catch_config_error
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\__init__.py", line 6, in <module>
    from .application import *
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\application.py", line 19, in <module>
    from traitlets.config.configurable import Configurable, SingletonConfigurable
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\configurable.py", line 12, in <module>
    from .loader import Config, LazyConfigValue, _is_section_key
  File "C:\Users\91949\Anaconda3\lib\site-packages\traitlets\config\loader.py", line 16, in <module>
    from ipython_genutils.path import filefind
  File "C:\Users\91949\Anaconda3\lib\site-packages\ipython_genutils\path.py", line 13, in <module>
    import random
  File "G:\Py\random.py", line 3, in <module>
    print(random.randint(20,30))
AttributeError: module 'random' has no attribute 'randint'
[W 16:52:57.701 NotebookApp] KernelRestarter: restart failed
[W 16:52:57.701 NotebookApp] Kernel aed55e95-532a-40e6-8d50-71d53ce9016b died, removing from map.
[W 16:53:42.428 NotebookApp] Timeout waiting for kernel_info reply from aed55e95-532a-40e6-8d50-71d53ce9016b
[E 16:53:42.430 NotebookApp] Error opening stream: HTTP 404: Not Found (Kernel does not exist: aed55e95-532a-40e6-8d50-71d53ce9016b)

0 个答案:

没有答案