Home  >  Article  >  Backend Development  >  How to install python3 in mac

How to install python3 in mac

尚
Original
2019-07-02 15:47:137412browse

How to install python3 in mac

A brief introduction to using HomeBrew to install Python 3.* version on Mac and set it to the default value

1. First check the python that comes with Mac, you can see that it is 2.7 .10 version

How to install python3 in mac

2. Check the installation package of python3

brew search python3

3. Install python3

brew install python3

You can see the actual version of python3 The installation directory is /usr/local/Cellar/python3/3.6.2

4. Open the configuration file and write python’s external environment variable

open ~/.bash_profile
 export PATH=${PATH}:/usr/local/Cellar/python3/3.6.2/bin

5. Rename python

alias python="/usr/local/Cellar/python3/3.6.2/bin/python3.6"

6. Let the configuration file take effect

source ~/.bash_profile

7. Use the python command to check

python

8. If the setting is not successful, use which python3 to check whether the location of Python3 is correct at this time. If not, Repeat steps 4, 5, and 6 correctly
which python3

How to install python3 in mac

For more Python related technical articles, please visit the Python Tutorial column to learn!

The above is the detailed content of How to install python3 in mac. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn