跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • jupyter-nbconvert.exe –generate-config 报错 UnicodeEncodeError: ‘gbk’
未分類
3 1 月 2021

jupyter-nbconvert.exe –generate-config 报错 UnicodeEncodeError: ‘gbk’

jupyter-nbconvert.exe –generate-config 报错 UnicodeEncodeError: ‘gbk’

資深大佬 : XIVN1987 0

报错信息为:

  File "c:python36venvlibsite-packagesjupyter_coreapplication.py", line 156, in write_default_config     f.write(config_text) UnicodeEncodeError: 'gbk' codec can't encode character 'xb6' in position 8440: illegal multibyte sequence 

查看“jupyter_coreapplication.py”内容如下:

with open(config_file, mode='w') as f:     f.write(config_text) 

改成:

with open(config_file, mode='w', encoding='utf-8') as f:     f.write(config_text) 

重新执行,执行成功,不再报错

这是 bug 吗?我要去提个 issue 吗?

大佬有話說 (2)

  • 資深大佬 : ysc3839

    个人觉得不算 bug,而是考虑不周全,没有检测文件编码。
    个人建议加个命令行参数,让用户手动指定文件编码。

  • 資深大佬 : Jirajine

    这是陈年老 bug(feature)了。Python 在 Windows 下默认使用系统环境的编码方式。

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具