Jupyter打开出错:'ascii' codec can't decode byte 0xe5 in position 4: ordinal not in range(128)

在python2.7环境下,使用anacoda安装jupyter notebook后,输入

jupyter notebook

无法打开jupyter,错误log如下:

The Jupyter HTML Notebook.

这将启动一个基于tornado的HTML笔记本服务器,它提供一个html5/
javascript笔记本客户端。

Traceback (most recent call last):
  File "/anaconda2/envs/python3/bin/jupyter-notebook", line 11, in <module>
    sys.exit(main())
  File "/anaconda2/envs/python3/lib/python2.7/site-packages/jupyter_core/application.py", line 266, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/anaconda2/envs/python3/lib/python2.7/site-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "/anaconda2/envs/python3/lib/python2.7/site-packages/traitlets/config/application.py", line 89, in catch_config_error
    app.print_help()
  File "/anaconda2/envs/python3/lib/python2.7/site-packages/traitlets/config/application.py", line 385, in print_help
    self.print_subcommands()
  File "/anaconda2/envs/python3/lib/python2.7/site-packages/traitlets/config/application.py", line 377, in print_subcommands
    print(os.linesep.join(lines))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 4: ordinal not in range(128)

Google后参考github上的一个issue,https://github.com/jupyterlab/jupyterlab/issues/5345,看到有人切换语言解决问题的:

屏幕快照 2019-01-07 下午5.20.07.png

于是尝试使用如下命令打开jupyter:

LANG=zn jupyter notebook

问题解决✅

推荐阅读更多精彩内容