jupyter笔记本坏翻译错误消息

时间:2018-04-20 16:37:28

标签: python jupyter-notebook

我尝试使用内核python3的jupyter笔记本,但是我收到了这条错误消息。

anonymous$ jupyter notebook
/usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory

有关安装在mac上的python和pip的信息(我使用pip3来安装jupyter):

anonymous$ which -a python python2 python2.7 python3 python3.6
/usr/bin/python
/usr/bin/python2.7
/usr/local/bin/python3
/usr/local/bin/python3.6
anonymous$ which -a pip pip2 pip3
/usr/local/bin/pip
/usr/local/bin/pip3

试图通过“brew update&& Brew upgrade jupyter”来解决它,正如另一篇文章所建议的但是没有用。收到错误消息“错误:未安装jupyter”。

7 个答案:

答案 0 :(得分:7)

您必须已使用其他程序包管理器(例如pip)安装了jupyter。您可以尝试pip uninstall jupyter,然后brew install jupyter

如果您收到消息:

Error: The `brew link` step did not complete successfully 
The formula built, but is not symlinked into /usr/local 
Could not symlink bin/jupyter 
Target /usr/local/bin/jupyter already exists.

您可以按照建议尝试brew link --overwrite jupyter

答案 1 :(得分:1)

我重新安装了带有pip3的jupyter笔记本,当我再次尝试取消笔记本的工作时一切正常。

pip3 install jupyter
jupyter notebook

答案 2 :(得分:1)

我遇到了同样的情况,并按照此处的建议尝试了 $brew install jupyter。但它给了我这个错误 -

Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)!
To rerun under ARM use:
arch -arm64 brew install ...
To install under x86_64, install Homebrew into /usr/local.

作为 M1 Mac 用户,这最终解决了问题 -

arch -arm64 brew install jupyter

答案 3 :(得分:0)

在虚拟环境中使用jupyter时,我遇到了相同的错误。这是我从homebrew的python切换到操作系统的python3的时候。

我要做的只是rm /usr/local/bin/jupyter-lab,然后运行jupyter-lab

答案 4 :(得分:0)

截至2020年10月,@ teresa的解决方案对我有用。

我必须运行pip3才能安装设备,您可以通过运行来检查需要使用哪个pip命令

pip -v 

如果一无所获,请尝试pip3 -v

根据其中一个起作用,输入:

pip3 install jupyter
jupyter notebook

答案 5 :(得分:0)

看起来“ pip3”会在内核中安装具有相同Python版本的jupyter,并在笔记本中使用该版本。

pip3 install jupyter
jupyter notebook

答案 6 :(得分:0)

当从以前可能不再存在的以前的python版本加载jupyter笔记本的内核时,通常会发生此问题。

  • 运行jupyter kernelspec list。 kernel.json包含正在使用的python版本的路径。您可以直接更改此路径,也可以核对Jupyter安装(如下所示)并重新安装。
  • 删除Jupyter文件夹位置(在Mac上为rm -rf /Users/<username>/Library/Jupyter/
  • brew uninstall jupyter; brew cleanup
  • 如果使用pip和pyenv:pip install jupyterlab否则为brew install jupyter
相关问题