How to uninstall python jupyter correctly?

2019-04-21 15:16发布

I have jupyter installed with python3.5 on my Mac OSX, but I want the python2.7 version. So, I basically need to uninstall the 3.5 version, and reinstall the 2.7 version.

But for some reason I can't uninstall the 3.5 version. I tried sudo python3 -m pip uninstall jupyter, and you can see the results below:

✔  ~/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

...as you can see above, the which jupyter command still returns a valid path, AND not only that. I'm still able to launch jupyter notebook from the command line, and it opens a notebook.

How do I correctly get rid of my existing version of jupyter ? OR, if someone knows how to ADD a python2 kernel to my existing jupyter, that would be fine too. Is that possible?

All I can think of is to manually kill the files and subfolders inside of /Library/Frameworks/Python.framework/Versions/3.5/bin/, but this seems unnecessarily brutal?

5条回答
狗以群分
2楼-- · 2019-04-21 16:06

You should uninstall the jupyter-core, jupyter-console, jupyter-client seperately. After remove them all, these is no package found named jupyter.

查看更多
乱世女痞
3楼-- · 2019-04-21 16:11

Use pip3 instead of pip

pip3 uninstall jupyter 

You can install for both python 2 and python 3 on the same computer as long as you use the correct pip version

查看更多
趁早两清
4楼-- · 2019-04-21 16:11

I have jupyter installed with python3.5 on my Mac OSX, but I want the python2.7 version.

Anaconda is a great way to install python software that you need for specific projects.

  1. Download from https://www.continuum.io/downloads#macos
  2. as said, bash Anaconda2-4.3.1-MacOSX-x86_64.sh (the 2.7 version in your case)
  3. go to the installed directory and type source bin/activate

This creates a command-line environment which has just the right level of libraries etc. Inside, you can install further data with f.ex. conda install numpy. To fix a version, use conda install numpy=1.10.

查看更多
Rolldiameter
5楼-- · 2019-04-21 16:13

From your home folder, delete ~/AnacondaProjects. After that remove the export of Anaconda environment variable from your bash profile ~/.bashrc .

查看更多
戒情不戒烟
6楼-- · 2019-04-21 16:13

The answer over here solved my problem: https://stackoverflow.com/a/42277762/8057434

I'll just summarize what to do. Run conda uninstall notebook nbconvert nbformat ipykernel ipywidgets qtconsole traitlets tornado jupyter_* ipython_genutils jinja2 -y in your terminal. You can use pip uninstall instead of conda uninstall if you aren't using anaconda.

查看更多
登录 后发表回答