Follow me on GitHub

Jupyter notebook 无法显示中文文件名

Jupyter notebook 无法显示中文文件名

步骤一:确定OS是否有问题

[root@533a171fb0b4 python]# rpm -qa | grep -i Chinese
google-noto-sans-simplified-chinese-fonts-20141117-5.el7.noarch
google-noto-sans-traditional-chinese-fonts-20141117-5.el7.noarch
[root@533a171fb0b4 python]# ls
Untitled1.ipynb  book  ??????.ipynb  ???????????????.ipynb  ??????.ipynb  ?????????.ipynb
[root@533a171fb0b4 python]# printenv | grep LC
[root@533a171fb0b4 python]# export LC_ALL=zh_CN.UTF-8
[root@533a171fb0b4 python]# printenv | grep LC
LC_ALL=zh_CN.UTF-8
[root@533a171fb0b4 python]# ls
book  Untitled1.ipynb  嵌套与递归.ipynb  你好.ipynb  水仙花.ipynb  正则.ipynb
[root@533a171fb0b4 python]# tail /etc/profile
export LC_ALL='en_US.UTF-8'

注意:需要设置 LC_ALL 参数名:export LC_ALL='en_US.UTF-8'

步骤二:查看 Jupyter 情况

步骤三:修改参数,重启生效

[root@533a171fb0b4 python]# ps -ef | grep jupyter-notebook
root      1198  1186  0 10:28 ?        00:00:02 /usr/bin/python3 /usr/local/bin/jupyter-notebook --allow-root
root      1287  1232  0 10:53 ?        00:00:00 grep --color=auto jupyter-notebook
[root@533a171fb0b4 python]# kill -15 1198
[root@533a171fb0b4 python]# 
[root@533a171fb0b4 python]# vi /etc/profile
[root@533a171fb0b4 python]# tail -n2 /etc/profile
export LC_ALL='en_US.UTF-8'
export LANGAGE=zh_CN
[root@533a171fb0b4 python]# 
[root@533a171fb0b4 python]# jupyter-notebook --allow-root
[I 10:54:59.893 NotebookApp] 启动notebooks 在本地路径: /srv/python
[I 10:54:59.893 NotebookApp] 本程序运行在: http://533a171fb0b4:8888/
[I 10:54:59.893 NotebookApp] 使用control-c停止此服务器并关闭所有内核(两次跳过确认).
[W 10:54:59.899 NotebookApp] 没有找到web浏览器: could not locate runnable browser.

注意:需要设置 LANGAGE 参数名:export LANGAGE=zh_CN

提示:如果仍然需要英文界面,则修改为 export LANGAGE=en_US 总之要保证有内容

参考资料:
notebook/notebook/i18n at 5.7.x · jupyter/notebook
Cann't open a notebook with Chinese name #6997

(完)
posted @ 2020-03-28 18:59  季文康  阅读(1133)  评论(0编辑  收藏  举报