目录
  • 错误描述
  • 解决方案
  • 总结

错误描述

本地Anaconda使用pip install jupyterlab后使用jupyter-lab打开窗口创建Terminal出现错误Launcher ErrorUnhandled errorDismiss

Jupyter Lab无法打开终端窗口的解决方法

解决方案

通过查询Anaconda窗口信息发现报错如下:

Traceback (most recent call last):
      File "e:\anaconda3\envs\pytorch1.6.0\lib\site-packages\tornado\web.py", line 1702, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "e:\anaconda3\envs\pytorch1.6.0\lib\site-packages\tornado\web.py", line 3173, in wrapper
        return method(self, *args, **kwargs)
      File "e:\anaconda3\envs\pytorch1.6.0\lib\site-packages\jupyter_server\terminal\api_handlers.py", line 26, in post
        name, _ = self.terminal_manager.new_named_terminal(**data)
      File "e:\anaconda3\envs\pytorch1.6.0\lib\site-packages\terminado\management.py", line 319, in new_named_terminal
        term = self.new_terminal(**kwargs)
      File "e:\anaconda3\envs\pytorch1.6.0\lib\site-packages\terminado\management.py", line 171, in new_terminal
        pty = PtyProcessUnicode.spawn(argv, env=env, cwd=options.get('cwd', None))
      File "e:\anaconda3\envs\pytorch1.6.0\lib\site-packages\winpty\ptyprocess.py", line 89, in spawn
        'executable: %s.' % command
    FileNotFoundError: The command was not found or was not executable: powershell.exe.

可以发现报错的原因是JupyterLab在创建Ternimal时无法定位到PowerShell。为此,我通过CMD启用PowerShell仍然失败,如下所示:

Jupyter Lab无法打开终端窗口的解决方法

因此怀疑时是环境变量中缺少`PowerShell`路径,因此我找到`PowerShell`路径并添加至环境变量,如下所示

Jupyter Lab无法打开终端窗口的解决方法

Jupyter Lab无法打开终端窗口的解决方法

Jupyter Lab无法打开终端窗口的解决方法

Jupyter Lab无法打开终端窗口的解决方法

完成后在CMD中输入PowerShell即可进入PowerShell模式

Jupyter Lab无法打开终端窗口的解决方法

此时打开Anaconda启动JupyterLab,即可正常启动Terminal,如下所示:

Jupyter Lab无法打开终端窗口的解决方法

总结

如果在Win10平台使用JupyterLab无法正常启动Terminal且报错为FileNotFoundError: The command was not found or was not executable: powershell.exe.,只需要在环境变量中添加PowerShell路径

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。