Ubuntu 安裝和使用 jupyter 出現的問題總結

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.

 


 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章