【问题标题】:How to uninstall python jupyter correctly?如何正确卸载 python jupyter?
【发布时间】:2017-01-30 11:46:31
【问题描述】:

我在我的Mac OSX 上安装了jupyterpython3.5,但我想要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 ?或者,如果有人知道如何将python2 内核添加到我现有的jupyter,那也可以。这可能吗?

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

【问题讨论】:

  • 试试sudo -H python3 -m pip uninstall jupyter
  • 结果是:20:39 $ sudo -H python3 -m pip uninstall jupyter Password: Cannot uninstall requirement jupyter, not installed 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.
  • @edwinksl,它并没有解决看起来的问题。不过谢谢。
  • 还有其他建议吗?
  • 也许不用sudo试试?

标签: python ipython jupyter jupyter-notebook


【解决方案1】:

这里的答案解决了我的问题: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

【讨论】:

  • 我还发现使用 pip freeze | grep jupyterpip3 freeze | grep jupyter 有助于查找要卸载的软件包名称。
【解决方案2】:

您应该分别卸载 jupyter-core、jupyter-console、jupyter-client。全部删除后,找不到名为 jupyter 的包。

【讨论】:

    【解决方案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.sh(你的情况是 2.7 版本)
    3. 进入安装目录并输入source bin/activate

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

    【讨论】:

      【解决方案4】:

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

      【讨论】:

        【解决方案5】:

        使用 pip3 代替 pip

        pip3 uninstall jupyter 
        

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

        【讨论】:

          猜你喜欢
          • 2016-01-08
          • 1970-01-01
          • 2018-09-26
          • 2021-01-10
          • 2019-10-12
          • 2017-01-04
          • 2011-05-24
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多