使用brew install python时提示Unversioned symlinks

继续安装新环境,在使用brew install python时,在最后安装完成时提示:

==> [email protected]
Python is installed as
  /opt/homebrew/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, are installed into
  /opt/homebrew/opt/[email protected]/libexec/bin

See: https://docs.brew.sh/Homebrew-and-Python

这段提示信息的意思是:未版本化的符号链接

符号链接的作用是什么呢?

(1)python:指向 python3
(2)python-config:指向 python3-config
(3)pip:指向 pip3

那么如何解决这个问题呢,也是按照前面的方法,将提示中的目录添加到环境变量中:

1、编辑zshrc

nano ~/.zshrc

2、添加下面环境变量内容,保存退出:

export PATH="/opt/homebrew/opt/[email protected]/libexec/bin:$PATH"

3、使环境变量生效

source ~/.zshrc

4、验证符号链接

jasper.zhang@localhost ~ % which python
/opt/homebrew/opt/[email protected]/libexec/bin/python
jasper.zhang@localhost ~ % which pip
/opt/homebrew/opt/[email protected]/libexec/bin/pip
jasper.zhang@localhost ~ % python --version
Python 3.13.2
jasper.zhang@localhost ~ % pip --version
pip 25.0 from /opt/homebrew/lib/python3.13/site-packages/pip (python 3.13)

【总结】

在安装环境的过程中,大家不要忽略一些看似非关键的信息,例如 warning 和 提示信息。虽然这些信息并未直接报错,但如果能够提前发现并解决,可以在后续开发中避免潜在问题,从而节省大量时间和精力。

你可能感兴趣的:(常用工具,环境安装,python,mac)