[Meng new] install python3, pip3, ipython notebook development environment under Mac OS

[Meng new] install python3, pip3, ipython notebook development environment under Mac OS

HOMEBREW install python3

Mac comes with Python2, and it is the system's default python startup version. In most cases, you need to install python3 and change it to the default version of the terminal. After following many online tutorials, the truth is not the same as the expected result of running on your own computer. Just remember your installation process, sometimes it's just a mess, and you don't know why ...

brew search python

It is found that the python in formulae is marked with a green check, indicating that python2 has been installed.

brew install python3

Install python3 using brew.
Then check:

brew search python3

It is found that python3 in formulae is marked with a green check, indicating that Python3 has been installed.
Try directly here:

brew search python

You can't get the results of the two versions together, which means that its search is name-specific. I don't know what I want to express. I just want to say that python and python3 are two things in the system. When running some instructions, these two names represent completely different versions. Maybe it's because I didn't change the python running version of the terminal to python3, and the path setting was not successful, or I still didn't understand it.
Both paths:

which python

Get: / usr / bin / python

which python3

Get: /Library/Frameworks/Python.framework/Versions/3.6/bin/python3

Install pip3

Python3 comes with pip3 after installation. The same problem is that the relationship between pip and pip3 is just like python and python3. Pay attention to this point when following many online tutorials.
First update the version of pip3:

pip3 install --upgrade pip

Then this pip3 should work, and continue to be used to install the things behind.

Install IPython

pip3 install --user IPython

case-sensitive input.

Install notebook / Jupyter

I ran the commands separately because they all ran out of chaos ... just list them first, and forget which one worked. Continue to force ...

pip3 install --user notebook
pip3 install --user jupyter

At this point, it is considered that all environments have been installed, but at runtime, according to other tutorials, directly enter in the terminal: jupyter notebook This command will return the following result: jupyter: command not found.
However, goose jupyter or ipython is already installed. So I think the problem is that I use pip3 to install them in the python3 environment, and the terminal defaults to the python2 version, so I can't find the instructions. I went back and followed the related tutorials. Unfortunately, the default path was not changed successfully, so I tried a few other commands that didn't know the reason ... I opened the server web of jupyter and it worked.

Run Jupyter

Non-running instructions:

python3 jupyter notebook
python3 ipython notebook
python3 -m jupyter notebook
python3 -m ipython notebook
python3 -m IPython notebook
python3 IPython notebook

The only executable instruction

python3 -m IPython notebook

My friend said -m This option is "-m is to run the python module as a script." I didn't fully understand the meaning, so write down here first. In short, jupyter cannot be run without this option. Then IPython is case sensitive, I am really old blood ...

At this point, you can open the webpage, how to use it later to learn slowly ...

note

Due to version and path issues, I feel that if I do not change the default settings, similar problems will definitely be encountered in the future. The packages installed with pip3 in the future should be in the python3 environment. When the terminal is running, the two prefixes python3 -m are estimated to be inevitable. In other words, there must be such a command to clarify that I run some plugins in the python3 environment, I hope I remember QAQ ...

Published 9 original articles · won 0 · views 865

Guess you like

Origin blog.csdn.net/weixin_43138930/article/details/87031816