解決 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
