Python3 and python2 question


(Gea) #1

hello guys,
recently, i want to install python3 and study it ,then i noticed that python3 became python ,i’d like to know is everything running ok on python3 in mac? it seems like that there many things rely on python2. if i upgrade python2 to python3 ,is everything will be ok? if not , i install python@2 can solve them? the env makes me confused, can someone help me ?


(Hsiao Yi) #2

Based on my understanding, no matter you install which python. Homebrew will not remove the default system python. It should not break anything shipped by system.


(Andrew Janke) #3

When you install either python or python@2 via Homebrew, it will not remove the system Python. Homebrew never removes system packages.

However: When you install python@2, it installs a python command into /usr/local/bin, which is probably on your path. If there are programs that invoke Python as plain python instead of as /usr/bin/python, they will run using the Homebrewed Python 2, instead of the system Python. This could break things that are expecting the system python.

Hopefully, all of the stuff shipped with the system is using the qualified /usr/bin/python to protect against this.

The Python 3 python formula installs a python3 command; it does not install a python command. Installing it should not interfere with anything that calls python and expects it to be Python 2. So it should be safe to brew install python and experiment with it.

Python is still in a transition from Python 2 to Python 3, so it’s expected (at least by Homebrew) that there will be side-by-side installations of Python 2 and 3.


(Gea) #4

thank for your help!