Jupyter无法在主目录之外启动

时间:2018-11-22 10:56:06

标签: python anaconda jupyter-notebook jupyter file-not-found

我重新安装了Anaconda 3.7,并尝试通过执行以下操作打开Jupyter笔记本:

  1. 未安装的Anaconda 3.6。
  2. 删除注册表中的所有anaconda,jupyter和python键。
  3. 删除文件系统上的所有anaconda,jupyter和python文件和文件夹。
  4. 重新启动。
  5. 已安装64位Anaconda 3.7(在Windows 10 Pro 64位上)。我在安装程序中勾选了“添加到路径”选项。
  6. 打开PowerShell。
  7. 使用jupyter notebook命令启动jupyter笔记本。
  8. 尝试通过在浏览器中选择笔记本来打开笔记本。

我收到以下错误:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Users\Tom Oakley> cd \code
PS C:\code> jupyter notebook
[I 09:57:26.662 NotebookApp] JupyterLab extension loaded from C:\Anaconda3.7\lib\site-packages\jupyterlab
[I 09:57:26.662 NotebookApp] JupyterLab application directory is C:\Anaconda3.7\share\jupyter\lab
[I 09:57:26.678 NotebookApp] Serving notebooks from local directory: C:\code
[I 09:57:26.678 NotebookApp] The Jupyter Notebook is running at:
[I 09:57:26.678 NotebookApp] http://localhost:8888/?token=5727bc46546f81bc6d795a7516f2758bfb01bdc764a47430
[I 09:57:26.678 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 09:57:26.725 NotebookApp]

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8888/?token=5727bc46546f81bc6d795a7516f2758bfb01bdc764a47430
[I 09:57:27.787 NotebookApp] Accepting one-time-token-authenticated connection from ::1
[W 09:57:38.081 NotebookApp] Notebook sandbox/parallel.ipynb is not trusted
[I 09:57:38.628 NotebookApp] Kernel started: 5296c75b-0bbe-45d9-897a-0d74a6a01dba
C:\code\sandbox
['.git', '.ipynb_checkpoints', '.mypy_cache', 'animation_example.py', 'parallel.ipynb', '__pycache__']
Traceback (most recent call last):
  File "C:\Anaconda3.7\lib\shutil.py", line 557, in move
    os.rename(src, real_dst)
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'test.py' -> 'test_dir.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Anaconda3.7\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Anaconda3.7\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Anaconda3.7\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "C:\Anaconda3.7\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "C:\Anaconda3.7\lib\site-packages\ipykernel\connect.py", line 13, in <module>
    from IPython.core.profiledir import ProfileDir
  File "C:\Anaconda3.7\lib\site-packages\IPython\__init__.py", line 54, in <module>
    from .core.application import Application
  File "C:\Anaconda3.7\lib\site-packages\IPython\core\application.py", line 16, in <module>
    from copy import deepcopy
  File "C:\code\sandbox\copy.py", line 9, in <module>
    shutil.move('test.py', 'test_dir.py')
  File "C:\Anaconda3.7\lib\shutil.py", line 571, in move
    copy_function(src, real_dst)
  File "C:\Anaconda3.7\lib\shutil.py", line 257, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "C:\Anaconda3.7\lib\shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: 'test.py'
[I 09:57:41.612 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports
C:\code\sandbox
['.git', '.ipynb_checkpoints', '.mypy_cache', 'animation_example.py', 'parallel.ipynb',  '__pycache__']
Traceback (most recent call last):
  File "C:\Anaconda3.7\lib\shutil.py", line 557, in move
    os.rename(src, real_dst)
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'test.py' -> 'test_dir.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Anaconda3.7\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Anaconda3.7\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Anaconda3.7\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "C:\Anaconda3.7\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "C:\Anaconda3.7\lib\site-packages\ipykernel\connect.py", line 13, in <module>
    from IPython.core.profiledir import ProfileDir
  File "C:\Anaconda3.7\lib\site-packages\IPython\__init__.py", line 54, in <module>
    from .core.application import Application
  File "C:\Anaconda3.7\lib\site-packages\IPython\core\application.py", line 16, in <module>
    from copy import deepcopy
  File "C:\code\sandbox\copy.py", line 9, in <module>
    shutil.move('test.py', 'test_dir.py')
  File "C:\Anaconda3.7\lib\shutil.py", line 571, in move
    copy_function(src, real_dst)
  File "C:\Anaconda3.7\lib\shutil.py", line 257, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "C:\Anaconda3.7\lib\shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: 'test.py'
[I 09:57:44.673 NotebookApp] KernelRestarter: restarting kernel (2/5), new random ports
C:\code\sandbox
['.git', '.ipynb_checkpoints', '.mypy_cache', 'animation_example.py', 'parallel.ipynb',  '__pycache__']
Traceback (most recent call last):
  File "C:\Anaconda3.7\lib\shutil.py", line 557, in move
    os.rename(src, real_dst)
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'test.py' -> 'test_dir.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Anaconda3.7\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Anaconda3.7\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Anaconda3.7\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "C:\Anaconda3.7\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "C:\Anaconda3.7\lib\site-packages\ipykernel\connect.py", line 13, in <module>
    from IPython.core.profiledir import ProfileDir
  File "C:\Anaconda3.7\lib\site-packages\IPython\__init__.py", line 54, in <module>
    from .core.application import Application
  File "C:\Anaconda3.7\lib\site-packages\IPython\core\application.py", line 16, in <module>
    from copy import deepcopy
  File "C:\code\sandbox\copy.py", line 9, in <module>
    shutil.move('test.py', 'test_dir.py')
  File "C:\Anaconda3.7\lib\shutil.py", line 571, in move
    copy_function(src, real_dst)
  File "C:\Anaconda3.7\lib\shutil.py", line 257, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "C:\Anaconda3.7\lib\shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: 'test.py'

使用conda update --all更新软件包没有区别。

使用jupyter lab会出现相同的错误。

有人知道为什么会这样以及如何解决吗?

我提交了bug with the Jupyter project

版本

jupyter                   1.0.0                    py37_7
jupyter_client            5.2.3                    py37_0
jupyter_console           6.0.0                    py37_0
jupyter_core              4.4.0                    py37_0
jupyterlab                0.35.3                   py37_0
jupyterlab_launcher       0.13.1                   py37_0
jupyterlab_server         0.2.0                    py37_0

2 个答案:

答案 0 :(得分:0)

尝试一次:1.打开Anaconda提示符 2.转到C:\ Users \ your_name 3.写下jupyter trust untitled.ipynb 4.然后,写jupyter notebook

答案 1 :(得分:0)

在我刚完成conda update --all之后,它似乎可以正常工作。

新版本是:

jupyter                   1.0.0                    py37_7
jupyter_client            5.2.4                    py37_0
jupyter_console           6.0.0                    py37_0
jupyter_core              4.4.0                    py37_0
jupyterlab                0.35.3                   py37_0
jupyterlab_launcher       0.13.1                   py37_0
jupyterlab_server         0.2.0                    py37_0