• 解决 jupyter labextension install 报错


    解决 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                   ipynbpymd文件互相转换
    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:pythonpython36lib	hreading.py", line 916, in _bootstrap_inner
        self.run()
      File "e:pythonpython36lib	hreading.py", line 864, in run
        self._target(*self._args, **self._kwargs)
      File "e:pythonpython36libsubprocess.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*****AppDataLocalTempjupyterlab-debug-kx1tois9.log
    

    主要是这句话:UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 281: illegal multibyte sequence

    解决办法

    找到python安装目录的libsite-packagesjupyterlabcommands.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

  • 相关阅读:
    Mina、Netty、Twisted一起学(七):公布/订阅(Publish/Subscribe)
    MySQL高可用之——keepalived+互为主从
    JS之BOM
    Mac下利用(xcode)安装git
    计算矩阵边缘元素之和
    什么是猴子补丁(monkey patch)
    协议支撑
    BZOJ 3727 PA2014 Final Zadanie 树形DP
    Linux cat命令
    iOS8新特性
  • 原文地址:https://www.cnblogs.com/banshaohuan/p/13652143.html
Copyright © 2020-2023  润新知