Home > Backend Development > Python Tutorial > How to install python3 in mac

How to install python3 in mac

Release: 2019-07-06 09:04:14
Original
7471 people have browsed it

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
Copy after login

3. Install python3

brew install python3
Copy after login

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
Copy after login

5. Rename python

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

6. Let the configuration file take effect

source ~/.bash_profile
Copy after login

7. Use the python command to check

python
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template