python - Jupyter 无法在主目录之外启动

标签 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. 已安装 Anaconda 3.7 64 位(在 Windows 10 Pro 64 位上)。我在安装程序中勾选了“添加到路径”选项。
  6. 打开 PowerShell。
  7. 使用 jupyternotebook 命令启动 jupyternotebook。
  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

最佳答案

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

关于python - Jupyter 无法在主目录之外启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53429392/

相关文章:

Python(scipy)从文本文件导入时间

python - 如何在 Windows 上配置 Tor 代理?

python - 无法在 Pycharm 中创建或导入现有的 conda 项目

python - 在网络浏览器中嵌入本地 Jupyter 笔记本单元

python-3.x - 调用笔记本时在终端中显示日志输出

python - 我不知道如何让 __slots__ 工作

python - 如何检查一个对象在 Python 中是否可迭代?

python - 如何聚合 conda 环境?

python - 无法安装 Python 包

python - 从函数调用 DataFrame .head() 时不起作用