2016-09-22 181 views
10

我的jupyter安裝了python3.5我的Mac OSX,但我想要python2.7版本。所以,我基本上需要卸載3.5版本,並重新安裝2.7版本。如何正確卸載python jupyter?

但由於某些原因,我無法卸載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/內的文件和子文件夾,但這看起來不必要的殘酷?

+2

試試'sudo -H python3 -m pip卸載jupyter'。 – edwinksl

+0

結果是:'20:39 $ sudo -H python3 -m pip卸載jupyter 密碼: 無法卸載要求jupyter,未安裝 您正在使用pip版本8.1.1,但是版本8.1.2可用。 您應該考慮通過'pip install --upgrade pip'命令進行升級。 ' – Sother

+0

@edwinksl,它不能解決它看起來像的問題。但是,謝謝。 – Sother

回答

1

使用PIP 3而不是PIP

pip3 uninstall jupyter 

可以,只要你使用正確點子版本

0

我已經jupyter安裝安裝兩個蟒蛇2和Python 3在同一臺計算機上python3.5在我的Mac OSX上,但我想要的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

3

從您的home文件夾中刪除~/AnacondaProjects。之後,從您的bash配置文件~/.bashrc中刪除exportAnaconda environment variable

2

在這裏回答解決我的問題: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

+1

我也發現使用'pip freeze | grep jupyter'和'pip3 freeze | grep jupyter'有助於查找要卸載的軟件包名稱。 – Harry

0

你應該分別卸載jupyter-core,jupyter-console,jupyter-client。將它們全部刪除後,這些沒有找到名爲jupyter的軟件包。