繁体   English   中英

如何正确卸载python jupyter?

[英]How to uninstall python jupyter correctly?

我已经jupyter安装python3.5的Mac OSX,但我想python2.7版本。 所以,我基本上需要卸载3.5版本,重新安装2.7版本。

但由于某种原因,我无法卸载 3.5 版本。 我试过sudo python3 -m pip uninstall jupyter ,你可以看到下面的结果:

✔  ~/current/directory  
20:08 $ which jupyter
/Library/Frameworks/Python.framework/Versions/3.5/bin/jupyter
✔  ~/current/directory  
20:08 $ sudo python3 -m pip uninstall jupyter
The directory '/Users/<username>/Library/Caches/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.
Cannot uninstall requirement jupyter, not installed
The directory '/Users/<username>/Library/Caches/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.
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
✘-1  ~/current/directory  
20:09 $ which jupyter
/Library/Frameworks/Python.framework/Versions/3.5/bin/jupyter

...正如你在上面看到的, which jupyter命令仍然返回一个有效的路径,不仅如此。 我仍然可以jupyter notebook启动jupyter notebook ,它会打开一个 notebook。

如何正确摆脱现有版本的jupyter 或者,如果有人知道如何将python2内核添加到我现有的jupyter ,那也没关系。 这可能吗?

我所能想到的就是手动杀死/Library/Frameworks/Python.framework/Versions/3.5/bin/的文件和子文件/Library/Frameworks/Python.framework/Versions/3.5/bin/ ,但这似乎不必要地残酷?

这里的答案解决了我的问题: https : //stackoverflow.com/a/42277762/8057434

我只是总结一下该怎么做。 运行

conda uninstall notebook nbconvert nbformat ipykernel ipywidgets qtconsole traitlets tornado jupyter_* ipython_genutils jinja2 -y

在您的终端中。

如果您不使用 anaconda,则可以使用pip uninstall而不是conda uninstall

从您的home文件夹中,删除~/AnacondaProjects 之后,从 bash 配置文件中删除Anaconda environment variableexport ~/.bashrc

使用 pip3 而不是 pip

pip3 uninstall jupyter 

只要您使用正确的 pip 版本,您就可以在同一台计算机上安装 python 2 和 python 3

我在 Mac OSX 上安装了带有 python3.5 的 jupyter,但我想要 python2.7 版本。

Anaconda 是安装特定项目所需的 Python 软件的好方法。

  1. https://www.continuum.io/downloads#macos下载
  2. bash Anaconda2-4.3.1-MacOSX-x86_64.shbash Anaconda2-4.3.1-MacOSX-x86_64.sh (您的情况下为 2.7 版本)
  3. 转到安装目录并输入source bin/activate

这将创建一个命令行环境,该环境具有适当级别的库等。在内部,您可以使用 f.ex 安装更多数据。 conda install numpy 要修复版本,请使用conda install numpy=1.10

您应该单独卸载 jupyter-core、jupyter-console、jupyter-client。 将它们全部删除后,找不到名为 jupyter 的包。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM