无法在 Ubuntu 中运行 jupyter notebook

无法在 Ubuntu 中运行 jupyter notebook

我已经使用以下方式安装了 jupyter notebook:

sudo pip3 install jupyter

它似乎有效但我收到了错误:

The directory '/home/user1/.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/user1/.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

当我运行它时:

jupyter notebook

我收到错误:

Error executing Jupyter command 'notebook': [Errno 8] Exec format error

答案1

我遇到了类似的问题。以下是我修复此问题的方法(在 Ubuntu 16.04 上):

sudo apt-get remove ipython
sudo apt-get purge ipython 
sudo apt-get autoremove
pip install jupyter

ipython 似乎是问题所在,因此删除它可以解决问题。

我现在可以跑步了jupyter notebook

答案2

正如在警告每当使用sudopip使用-H标志

sudo -H pip3 install jupyter

或者你可以直接使用标志--user而不sudo

pip3 install jupyter --user

--user标志解决了用户所有权问题

答案3

您是否尝试过以 root 身份运行它?

sudo jupyter notebook --allow-root

或者以 root 身份登录并运行以下命令:

jupyter notebook --allow-root

相关内容