解決 jupyter labextension install 報錯
阿新 • • 發佈:2020-09-11
解決 jupyter labextension install 報錯
目錄
Jupyter Lab 外掛安裝
# 查詢安裝的擴充套件 jupyter labextension list # 命令列安裝對應的擴充套件 jupyter labextension install @jupyterlab/git jupyter labextension install @jupyterlab/github jupyter labextension install @jupyterlab/debugger jupyter labextension install @krassowski/jupyterlab-lsp jupyter labextension install @lckr/jupyterlab_variableinspector # 或者直接通過juputer lab外掛管理安裝 # 進入jupyter介面,點選外掛圖示 # 在搜尋欄中搜索對應外掛名,如jupytext,可直接安裝外掛 # 刪除擴充套件 jupyter labextension uninstall my-extension
外掛推薦
jupyterlab_code_formatter 自動格式化程式碼
jupytext ipynb\py\md檔案互相轉換
jupyterlab_spellchecker markdown拼寫核對
@krassowski/jupyterlab-lsp 自動補全與跳轉定義
@jupyterlab/github
@jupyterlab/git
安裝時報錯資訊
λ jupyter labextension install @jupyterlab/toc Building jupyterlab assets (build:prod:minimize) |Exception in thread Thread-10: Traceback (most recent call last): File "e:\python\python36\lib\threading.py", line 916, in _bootstrap_inner self.run() File "e:\python\python36\lib\threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "e:\python\python36\lib\subprocess.py", line 1083, in _readerthread buffer.append(fh.read()) UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 281: illegal multibyte sequence An error occured. IndexError: list index out of range See the log file for details: C:\Users\*****\AppData\Local\Temp\jupyterlab-debug-kx1tois9.log
主要是這句話:UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 281: illegal multibyte sequence
解決辦法
找到python安裝目錄的lib\site-packages\jupyterlab\commands.py檔案,
第83行:
self.proc = self._create_process( cwd=cwd, env=env, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, universal_newlines=True )
修改為:
self.proc = self._create_process(
cwd=cwd,
env=env,
stderr=subprocess.STDOUT,
stdout=subprocess.PIPE,
universal_newlines=True,
encoding="UTF-8"
)
也就是增加一個引數encoding=“UTF-8”,就可以了。
參考:https://zhuanlan.zhihu.com/p/104143118
https://blog.csdn.net/qq_15988503/article/details/108445949