问题描述
在Ubuntu 16.04中使用sudo pip install jupyter
安装jupyter后,使用jupyter notebook
运行jupyter时出现错误:UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe5 in position 4: ordinal not in range 128
问题分析
很明显这是一个编码的问题。
奇怪的是,使用同样的方法在英文版Ubuntu 16.04中就没出现这个问题,在中文版中就存在这个问题。因此这个问题应该和系统版本有关。
解决办法
在网上搜索了很久,最后在这篇博文(https://blog.csdn.net/gq__97/article/details/82956664) 中找到灵感。
博主使用pip3重新安装了jupyter,解决了问题。
具体做法:
- 卸载jupyter和附加项
sudo pip uninstall jupyter
sudo pip uninstall jupyter-core
sudo pip uninstall jupyter-console
sudo pip uninstall jupyter-client
- 没有pip3的话,安装pip3
sudo apt install python3-pip
- 安装jupyter
sudo pip3 install jupyter
- 安装完成后,运行jupyter
jupyter notebook
成功跳出网页。