MAC Pro and install Python2 Python3

table of Contents

Installation Python2

MAC system has default with Python2.7, so no need to install it.

Installation Python3

brew install python3

Different versions of the Python path

MAC system comes Python2.7, and we Python3 installed, you can install pkg install or through the official website of the brew command. After installation, the file path thereof as follows:

  • Default (2.7): / System / Library / Frameworks / Python.framework / Versions / 2.7
  • Installation brew (2.7 / 3.x): / usr / local / Cellar / python
  • Installation pkg official website (3.x): / Library / Frameworks / Python.framework / Versions / 3.x

Configuring Python2 and Python3

vi ~ / .bash_profile

# Setting PATH for Python 2.7
PATH="/System/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
# Setting PATH for Python 3.6.5
PATH="/usr/local/Cellar/python/3.6.5/bin:${PATH}"

export PATH

vi ~ / .bashrc

alias python2='/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7'
alias python3='/usr/local/Cellar/python/3.6.5/bin/python3.6'
Published 465 original articles · won praise 1258 · Views 1.83 million +

Guess you like

Origin blog.csdn.net/Jmilk/article/details/104623759