Ubuntu 安装和使用 jupyter 出现的问题总结

2023-05-16

1、在终端中输入‘sudo pip3 install jupyter’, 出现黄色的‘warring',如下:

The directory '/home/stone/.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. The directory '/home/stone/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

解决方法:

在sudo 后面添加-H
sudo -H pip3 install jupyter

2、在安装jupyter过程中,出现了红色的’exception'

Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2482, in _dep_map
return self.__dep_map
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2344, in __getattr__
raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

解决方法:

在终端中,安装jupyter 之前,输入

sudo pip3 install -vU setuptools

3、jupyter 无法运行,提示kernet died

问题描述:

在terminal 下运行 jupyter notebook, 随后在chrome下打开一个py文件,

浏览器下出现“The kernel has died, and the automatic restart has failed”对话框,

可能问题原因

ipykernel的版本太老了,或者之前安装其他python版本的时候,有冲突的 ipykernel_launcher

解决方法:
所以通过upgrade ipykernel,terminal 输入

for python 2.    sudo pip install --upgrade ipykernel
for python 3.    sudo pip3 install --upgrade ipykernel

4、jupyter 无法运行,提示kernet died

问题描述:

jupyter 无法运行,提示kernet died

terminal中显示:ImportError: cannot import name ‘create_prompt_application’

可能原因:

原因是prompt-toolkit版本不匹配
我安装的是 prompt-toolkit-0.0.10

解决方法:

pip3 install prompt-toolkit==1.0.15

5、pip3安装工具包时很慢

问题原因:

系统默认的镜像源在国外,转到国内就好了

方法:

在家目录下创建.pip目录

sudo mkdir .pip


然后创建pip.conf文件

sudo touch .pip/pip.conf
sudo vim .pip/pip.conf

添加下面两行:

 [global]
  index-url = http://mirrors.aliyun.com/pypi/simple
  [install]
  trusted-host=mirrors.aliyun.com

保存,esc, vim 保存并退出:wq.


 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Ubuntu 安装和使用 jupyter 出现的问题总结 的相关文章

随机推荐