前言
在 mac 上安装 python 后,会自动在 .zprofile
文件中,加入:
# Setting PATH for Python 3.12
# The original version is saved in .zprofile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.12/bin:${PATH}"
export PATH
此时,python -V
,还是会报错 zsh: command not found: python
解决
# 编辑环境变量文件
vim .zprofile
# 新增如下
alias python="/Library/Frameworks/Python.framework/Versions/3.12/bin/python3"
# 更新环境变量
source .zprofile
$ python -V
Python 3.12.1
标签:python,zprofile,3.12,Python,mac,command,PATH
From: https://www.cnblogs.com/niuben/p/17925043.html