简体   繁体   中英

Change python2 to python3 when using the terminal for jupyter notebook

I hope someone can help me out with the following;

On my mac I have by default Python 2.x. I now have to open Jupyter notebook with Python 3.8 from the terminal. I have already downloaded Python 3.8. I tried python3 -m notebook but this doesn't seem to work. Does someone know how to do this?

To download pip I used in my terminal:

$ sudo easy_install pip

Using the terminal I installed the package

$ pip install rdflib

then I installed Jupyter notebook in my terminal using:

$ pip install jupyterlab

Thanks!

Since Python 2 is the default on your system, it's likely (but not certain) that pip runs the Python 2 version of Pip. You can check by running

$ pip --version

It will print out the Python version that pip works with. If you find that it is Python 2, that means that running pip install to install a package only installs it for Python 2.

In order to make the package available in your default version of Python 3, you'd have to run

pip3 install notebook

I'd guess that for you, the default version of Python 3 is probably Python 3.8, unless you have yet another version of Python 3 installed. If you do, then you might need to run

pip3.8 install notebook

to be completely sure that it gets installed with Python 3.8 rather than whatever other version you have installed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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