Installing Python 3 on Mac
You can skip this section if you have already installed Python 3 on your Mac using the official Python installer here or Homebrew.
If you don't have Python 3 installed, it's easy to do using a homebrew command:
brew install python
This will install the Python 3 available through HomeBrew Get the latest Python 3 version. Likewise, you can install it using the Python 3 installer, or even the MacAdmins Python version if you prefer.
How to make Python 3 the default in MacOS
We assume you are using the default Zsh shell (or Oh My Zsh) and modify .zshrc accordingly, but if you are still using bash, Then you should add the alias to .bashrc.
- From the terminal, open zshrc in the text editor of your choice, for convenience we will use nano:
nano ~/.zshrc
- Add the following alias at the bottom of the .zshrc file:
alias python=/usr/local/bin/python3
- Press Control-O, then Control-X to save your edits and exit nano
Now you can confirm that the alias is valid by checking the python version:
$ python --version<br>Python 3.9.8
This should The same response as when you typed it, because the python command was aliased to python3:
python3 --version
Remember, this is just an alias. If you continue to install the original Python 2.7.x version on your Mac, you can access and use it by specifying the full path, like this:
/usr/bin/python
Please remember that Python 2.x will no longer be bundled in a future version of MacOS.
We used aliases in this example, but if you prefer to go this route, you can use a symlink that links /usr/bin/python3 to /usr/bin/python.
What happened to Python in MacOS?
For those who don’t know, Apple has been warning for some time that Python will be deprecated in future macOS versions, and that time has finally arrived with the arrival of macOS Monterey 12.3. This can be found in the developer notes, listed under Deprecations:
Deprecation
Python 2.7 has been removed from macOS in this update. Developers should use Python 3 or an alternative language. (39795874)
So if you depend or have relied on Python 2.7.x for any specific reason, you either need to update your program for Python 3 compatibility or maintain the old deprecated Python 2.x version (this could use Homebrew etc.), or rewrite everything and move to another language entirely.
The above is the detailed content of Make Python 3 the default interpreter on MacOS. For more information, please follow other related articles on the PHP Chinese website!

本篇文章给大家带来了关于Python的相关知识,其中主要介绍了关于Seaborn的相关问题,包括了数据可视化处理的散点图、折线图、条形图等等内容,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于Python的相关知识,其中主要介绍了关于进程池与进程锁的相关问题,包括进程池的创建模块,进程池函数等等内容,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于Python的相关知识,其中主要介绍了关于简历筛选的相关问题,包括了定义 ReadDoc 类用以读取 word 文件以及定义 search_word 函数用以筛选的相关内容,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于Python的相关知识,其中主要介绍了关于数据类型之字符串、数字的相关问题,下面一起来看一下,希望对大家有帮助。

VS Code的确是一款非常热门、有强大用户基础的一款开发工具。本文给大家介绍一下10款高效、好用的插件,能够让原本单薄的VS Code如虎添翼,开发效率顿时提升到一个新的阶段。

本篇文章给大家带来了关于Python的相关知识,其中主要介绍了关于numpy模块的相关问题,Numpy是Numerical Python extensions的缩写,字面意思是Python数值计算扩展,下面一起来看一下,希望对大家有帮助。

pythn的中文意思是巨蟒、蟒蛇。1989年圣诞节期间,Guido van Rossum在家闲的没事干,为了跟朋友庆祝圣诞节,决定发明一种全新的脚本语言。他很喜欢一个肥皂剧叫Monty Python,所以便把这门语言叫做python。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

Dreamweaver Mac version
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

Notepad++7.3.1
Easy-to-use and free code editor

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
