写在前面:我觉得任何时候应该都可以直接尝试第4步的方法
1.如果你有幸还没有安装,那么在安装过程中通常会遇到pip版本问题导致的编码错误:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 4: ordinal not in range(128)
该问题是由于python2版本的pip编码方式非utf-8导致的,此时应注意用Python3版pip进行安装,如下:
sudo python3 -m pip install --upgrade pip
sudo python3 -m pip install jupyter
2.如果你已经遇到编码错误问题了,可尝试重装Jupyter、直接如第1步再次用python3版的pip安装jupyter或者安装Conda在Conda上运行Jupyter Notebook,此方法教程较多,可自行百(goo)度(gle)。虽然很遗憾,由于空间有限,笔者没有尝试安装Conda的方法,但以上其他方法都没有解决笔者的电脑上的问题。笔者运行上述方法的命令都显示 Requirement already up-to-date 或者 Requirement already satisfied。
3. 笔者最终歪打正着,成功地直接卸载jupyter 和 notebook。(不知道什么原因显示jupyter没有安装,但是运行jupyter --version成功显示版本信息)。
best@best-ThinkPad-X1-Yoga-1st:~$ sudo pip uninstall jupyter
/home/best/.local/lib/python2.7/site-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
warnings.warn(warning, RequestsDependencyWarning)
The directory '/home/best/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Skipping jupyter as it is not installed.
best@best-ThinkPad-X1-Yoga-1st:~$ sudo pip uninstall jupyter notebook
/home/best/.local/lib/python2.7/site-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
warnings.warn(warning, RequestsDependencyWarning)
The directory '/home/best/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Uninstalling notebook-5.7.4:
Would remove:
/usr/local/bin/jupyter-bundlerextension
/usr/local/bin/jupyter-nbextension
/usr/local/bin/jupyter-notebook
/usr/local/bin/jupyter-serverextension
/usr/local/lib/python2.7/dist-packages/notebook-5.7.4.dist-info/*
/usr/local/lib/python2.7/dist-packages/notebook/*
Proceed (y/n)? y
Successfully uninstalled notebook-5.7.4
Skipping jupyter as it is not installed.
(之后再次安装jupyter依然显示requirement already satisfied)
此时再运行jupyter notebook就会显示没有notebook。
best@best-ThinkPad-X1-Yoga-1st:~$ jupyter notebook
Error executing Jupyter command 'notebook': [Errno 2] No such file or directory
4.此时依照网上一个超棒的教程(笔者认为),强制重装jupyter:
# For Python 3
pip3 install --upgrade --force-reinstall --no-cache-dir jupyter
之后运行命令:jupyter notebook,成功启动。