首頁 > 軟體

Jupyter Lab無法開啟終端視窗的解決方法

2023-02-10 06:01:09

錯誤描述

本地Anaconda使用pip install jupyterlab後使用jupyter-lab開啟視窗建立Terminal出現錯誤Launcher ErrorUnhandled errorDismiss

解決方案

通過查詢Anaconda視窗資訊發現報錯如下:

Traceback (most recent call last):
      File "e:anaconda3envspytorch1.6.0libsite-packagestornadoweb.py", line 1702, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "e:anaconda3envspytorch1.6.0libsite-packagestornadoweb.py", line 3173, in wrapper
        return method(self, *args, **kwargs)
      File "e:anaconda3envspytorch1.6.0libsite-packagesjupyter_serverterminalapi_handlers.py", line 26, in post
        name, _ = self.terminal_manager.new_named_terminal(**data)
      File "e:anaconda3envspytorch1.6.0libsite-packagesterminadomanagement.py", line 319, in new_named_terminal
        term = self.new_terminal(**kwargs)
      File "e:anaconda3envspytorch1.6.0libsite-packagesterminadomanagement.py", line 171, in new_terminal
        pty = PtyProcessUnicode.spawn(argv, env=env, cwd=options.get('cwd', None))
      File "e:anaconda3envspytorch1.6.0libsite-packageswinptyptyprocess.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仍然失敗,如下所示:

因此懷疑時是環境變數中缺少`PowerShell`路徑,因此我找到`PowerShell`路徑並新增至環境變數,如下所示

完成後在CMD中輸入PowerShell即可進入PowerShell模式

此時開啟Anaconda啟動JupyterLab,即可正常啟動Terminal,如下所示:

總結

如果在Win10平臺使用JupyterLab無法正常啟動Terminal且報錯為FileNotFoundError: The command was not found or was not executable: powershell.exe.,只需要在環境變數中新增PowerShell路徑

到此這篇關於Jupyter Lab無法開啟終端視窗的解決方法的文章就介紹到這了,更多相關Jupyter Lab終端視窗內容請搜尋it145.com以前的文章或繼續瀏覽下面的相關文章希望大家以後多多支援it145.com!


IT145.com E-mail:sddin#qq.com