`jupyter notebook` 在 cmd win 10 中抛出 `jupyter` 无法识别错误

`jupyter notebook` 在 cmd win 10 中抛出 `jupyter` 无法识别错误

我从 stackoverflow 移走了这个问题,因为据说这个堆栈更合适

我在离线模式下使用 Python 3.8。也就是说,如果我需要安装某个包,我会去下载它package.whlpackage.tar.gz使用 进行安装pip install package.whl。有一次我想安装 jupyter notebook,它需要安装一堆其他包。我耐心地安装了所有必要的包。最后,我有以下跟踪:

    pip install jupyter-1.0.0.tar.gz
Processing c:\py38\lib\site-packages\jupyter-1.0.0.tar.gz
Requirement already satisfied: notebook in c:\py38\lib\site-packages (from jupyter==1.0.0) (6.0.2)
Requirement already satisfied: qtconsole in c:\py38\lib\site-packages (from jupyter==1.0.0) (4.6.0)
Requirement already satisfied: jupyter-console in c:\py38\lib\site-packages (from jupyter==1.0.0) (6.1.0)
Requirement already satisfied: nbconvert in c:\users\user\appdata\roaming\python\python38\site-packages (from jupyter==1.0.0) (5.6.1)
Requirement already satisfied: ipykernel in c:\users\user\appdata\roaming\python\python38\site-packages (from jupyter==1.0.0) (5.1.3)
Requirement already satisfied: ipywidgets in c:\py38\lib\site-packages (from jupyter==1.0.0) (7.5.1)
Requirement already satisfied: jinja2 in c:\py38\lib\site-packages (from notebook->jupyter==1.0.0) (2.10.3)
Requirement already satisfied: tornado>=5.0 in c:\py38\lib\site-packages (from notebook->jupyter==1.0.0) (6.0.3)
Requirement already satisfied: pyzmq>=17 in c:\users\user\appdata\roaming\python\python38\site-packages (from notebook->jupyter==1.0.0) (18.1.1)
Requirement already satisfied: ipython_genutils in c:\users\user\appdata\roaming\python\python38\site-packages (from notebook->jupyter==1.0.0) (0.2.0)
Requirement already satisfied: traitlets>=4.2.1 in c:\users\user\appdata\roaming\python\python38\site-packages (from notebook->jupyter==1.0.0) (4.3.3)
Requirement already satisfied: jupyter_core>=4.6.0 in c:\users\user\appdata\roaming\python\python38\site-packages (from notebook->jupyter==1.0.0) (4.6.1)
Requirement already satisfied: jupyter_client>=5.3.4 in c:\users\user\appdata\roaming\python\python38\site-packages (from notebook->jupyter==1.0.0) (5.3.4)
Requirement already satisfied: nbformat in c:\users\user\appdata\roaming\python\python38\site-packages (from notebook->jupyter==1.0.0) (5.0.3)
Requirement already satisfied: Send2Trash in c:\users\user\appdata\roaming\python\python38\site-packages (from notebook->jupyter==1.0.0) (1.5.0)
Requirement already satisfied: terminado>=0.8.1 in c:\users\user\appdata\roaming\python\python38\site-packages (from notebook->jupyter==1.0.0) (0.8.3)
Requirement already satisfied: prometheus_client in c:\py38\lib\site-packages (from notebook->jupyter==1.0.0) (0.7.1)
Requirement already satisfied: pygments in c:\users\user\appdata\roaming\python\python38\site-packages (from qtconsole->jupyter==1.0.0) (2.5.2)
Requirement already satisfied: ipython in c:\users\user\appdata\roaming\python\python38\site-packages (from jupyter-console->jupyter==1.0.0) (7.8.0)
Requirement already satisfied: prompt_toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in c:\users\user\appdata\roaming\python\python38\site-packages (from jupyter-console->jupyter==1.0.0) (2.0.2)
Requirement already satisfied: mistune<2,>=0.8.1 in c:\users\user\appdata\roaming\python\python38\site-packages (from nbconvert->jupyter==1.0.0) (0.8.4)
Requirement already satisfied: entrypoints>=0.2.2 in c:\users\user\appdata\roaming\python\python38\site-packages (from nbconvert->jupyter==1.0.0) (0.3)
Requirement already satisfied: bleach in c:\users\user\appdata\roaming\python\python38\site-packages (from nbconvert->jupyter==1.0.0) (3.1.0)
Requirement already satisfied: pandocfilters>=1.4.1 in c:\users\user\appdata\roaming\python\python38\site-packages (from nbconvert->jupyter==1.0.0) (1.4.2)
Requirement already satisfied: testpath in c:\users\user\appdata\roaming\python\python38\site-packages (from nbconvert->jupyter==1.0.0) (0.4.4)
Requirement already satisfied: defusedxml in c:\users\user\appdata\roaming\python\python38\site-packages (from nbconvert->jupyter==1.0.0) (0.6.0)
Requirement already satisfied: widgetsnbextension~=3.5.0 in c:\py38\lib\site-packages (from ipywidgets->jupyter==1.0.0) (3.5.1)
Requirement already satisfied: MarkupSafe>=0.23 in c:\py38\lib\site-packages (from jinja2->notebook->jupyter==1.0.0) (1.1.1)
Requirement already satisfied: six in c:\users\user\appdata\roaming\python\python38\site-packages (from traitlets>=4.2.1->notebook->jupyter==1.0.0) (1.14.0)
Requirement already satisfied: decorator in c:\users\user\appdata\roaming\python\python38\site-packages (from traitlets>=4.2.1->notebook->jupyter==1.0.0) (4.4.1)
Requirement already satisfied: pywin32>=1.0 in c:\users\user\appdata\roaming\python\python38\site-packages (from jupyter_core>=4.6.0->notebook->jupyter==1.0.0) (227)
Requirement already satisfied: python-dateutil>=2.1 in c:\users\user\appdata\roaming\python\python38\site-packages (from jupyter_client>=5.3.4->notebook->jupyter==1.0.0) (2.5.0)
Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in c:\users\user\appdata\roaming\python\python38\site-packages (from nbformat->notebook->jupyter==1.0.0) (3.0.0)
Requirement already satisfied: pywinpty>=0.5; os_name == "nt" in c:\users\user\appdata\roaming\python\python38\site-packages (from terminado>=0.8.1->notebook->jupyter==1.0.0) (0.5.7)
Requirement already satisfied: setuptools>=18.5 in c:\users\user\appdata\roaming\python\python38\site-packages (from ipython->jupyter-console->jupyter==1.0.0) (45.1.0)
Requirement already satisfied: jedi>=0.10 in c:\users\user\appdata\roaming\python\python38\site-packages (from ipython->jupyter-console->jupyter==1.0.0) (0.14.1)
Requirement already satisfied: pickleshare in c:\users\user\appdata\roaming\python\python38\site-packages (from ipython->jupyter-console->jupyter==1.0.0) (0.7.5)
Requirement already satisfied: backcall in c:\users\user\appdata\roaming\python\python38\site-packages (from ipython->jupyter-console->jupyter==1.0.0) (0.1.0)
Requirement already satisfied: colorama in c:\users\user\appdata\roaming\python\python38\site-packages (from ipython->jupyter-console->jupyter==1.0.0) (0.4.3)
Requirement already satisfied: wcwidth in c:\users\user\appdata\roaming\python\python38\site-packages (from prompt_toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->jupyter-console->jupyter==1.0.0) (0.1.8)
Requirement already satisfied: webencodings in c:\users\user\appdata\roaming\python\python38\site-packages (from bleach->nbconvert->jupyter==1.0.0) (0.5.1)
Requirement already satisfied: attrs>=17.4.0 in c:\users\user\appdata\roaming\python\python38\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->notebook->jupyter==1.0.0) (19.3.0)
Requirement already satisfied: pyrsistent>=0.14.0 in c:\users\user\appdata\roaming\python\python38\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->notebook->jupyter==1.0.0) (0.15.7)
Requirement already satisfied: parso>=0.5.0 in c:\users\user\appdata\roaming\python\python38\site-packages (from jedi>=0.10->ipython->jupyter-console->jupyter==1.0.0) (0.5.0)
Installing collected packages: jupyter
  Found existing installation: jupyter 1.0.0
    Uninstalling jupyter-1.0.0:
      Successfully uninstalled jupyter-1.0.0
    Running setup.py install for jupyter ... done
Successfully installed jupyter-1.0.0

我想 ”现在它可以工作了“但我错了,jupyter notebook终端中的命令抛出了: 'jupyter' is not recognized as an internal or external command, operable program or batch file.

为了找到解决方案,我谷歌了一下,发现要么使用 Anaconda,要么在我的C:\py38\脚本路径(并且该确切路径应添加到系统变量中)。但我jupyter.exe那里没有,但我已经添加了C:\py38\脚本到上面提到的地方。我不愿意使用 Anaconda(这是另一个故事),对于后期,文件夹中有这些文件:

在此处输入图片描述

我尝试重新启动电脑,但无济于事。

有人能帮忙吗?谢谢

编辑:我不知道jupyter-notebook应该做什么但是当我输入它时cmd它会抛出以下内容:

jupyter-notebook
Traceback (most recent call last):
  File "C:\py38\Scripts\jupyter-notebook-script.py", line 11, in <module>
    load_entry_point('notebook==6.0.2', 'console_scripts', 'jupyter-notebook')()
  File "C:\Users\user\AppData\Roaming\Python\Python38\site-packages\jupyter_core\application.py", line 268, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "C:\Users\user\AppData\Roaming\Python\Python38\site-packages\traitlets\config\application.py", line 663, in launch_instance
    app.initialize(argv)
  File "<C:\Users\user\AppData\Roaming\Python\Python38\site-packages\decorator.py:decorator-gen-7>", line 2, in initialize
  File "C:\Users\user\AppData\Roaming\Python\Python38\site-packages\traitlets\config\application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "c:\py38\lib\site-packages\notebook\notebookapp.py", line 1720, in initialize
    self.init_webapp()
  File "c:\py38\lib\site-packages\notebook\notebookapp.py", line 1482, in init_webapp
    self.http_server.listen(port, self.ip)
  File "c:\py38\lib\site-packages\tornado\tcpserver.py", line 152, in listen
    self.add_sockets(sockets)
  File "c:\py38\lib\site-packages\tornado\tcpserver.py", line 165, in add_sockets
    self._handlers[sock.fileno()] = add_accept_handler(
  File "c:\py38\lib\site-packages\tornado\netutil.py", line 279, in add_accept_handler
    io_loop.add_handler(sock, accept_handler, IOLoop.READ)
  File "c:\py38\lib\site-packages\tornado\platform\asyncio.py", line 99, in add_handler
    self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)
  File "c:\py38\lib\asyncio\events.py", line 501, in add_reader
    raise NotImplementedError
NotImplementedError

答案1

所以我找到了一个与 Python 3.8 和 Jupyter 相关的问题。我执行了上述所有步骤,但都没有奏效。

time.clock() 函数自 Python 3.3 起就被弃用了,现已被移除:请根据您的需求使用 time.perf_counter() 或 time.process_time() 来获得明确定义的行为。(由 Matthias Bussonnier 在 bpo-36895 中贡献。)

它来自这里,我降级到 python 3.7 并且它可以工作。

答案2

100% 有效的解决方案:
这是由于“环境变量”

按着这些次序:

  1. 打开下载“python-3.8.2-amd64.exe”安装程序或任何其他版本的python包的文件夹
  2. 双击“python-3.8.2-amd64.exe”
  3. 点击“修改”
  4. 您将看到“可选功能”
  5. 点击下一步”
  6. 选择“将python添加到环境变量”
  7. 点击“安装”

然后,您可以在所需的任何文件夹中运行 jupyter,
例如打开“cmd”命令提示符并输入:

E:
E:> jupyter notebook

它将启动而不显示

Jupyter' 无法被识别

答案3

以下命令对我有用:
在命令提示符下,运行

  1. pip install notebook
  2. jupyter notebook

答案4

我发现 jupyter notebook 并没有安装在我认为的位置,因此我的环境变量需要更新。我找到了 jupyter.exe 文件C:\Users\<NAME OF USER>\AppData\Roaming\Python\Python38\scripts。一旦我将其添加到我的环境变量中,我就可以运行 jupyter notebook 命令。我还将其添加C:\Users\<NAME OF USER>\AppData\Roaming\Python\Python38\site-packages到我的 EVs 中,以防有任何依赖项。

相关内容