通过HomeBrew安装的Python启动命令为Python3,pip3
HomeBrew安装Python的命令为:
brew install python
然而,很多脚本里Python的启动命令为Python
如何使OSX上的Python3命令通过Python启动呢?
1.执行下列命令
brew info python
会得到如下输出信息:
==> [email protected]: stable 3.12.3 (bottled) Interpreted, interactive, object-oriented programming language https://www.python.org/ /usr/local/Cellar/[email protected]/3.12.2_1 (3,238 files, 63.6MB) Poured from bottle using the formulae.brew.sh API on 2024-03-27 at 19:51:29 From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/p/[email protected] License: Python-2.0 ==> Dependencies Build: pkg-config ✔ Required: mpdecimal ✔, openssl@3 ✔, sqlite ✔, xz ✘ ==> Caveats Python has been installed as /usr/local/bin/python3 Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to `python3`, `python3-config`, `pip3` etc., respectively, have been installed into /usr/local/opt/[email protected]/libexec/bin See: https://docs.brew.sh/Homebrew-and-Pythonz
注意这部分:
==> Caveats Python has been installed as /usr/local/bin/python3 Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to `python3`, `python3-config`, `pip3` etc., respectively, have been installed into /usr/local/opt/[email protected]/libexec/bin
告诉你如何设置链接到Python命令的方法。
2.执行下列语句设置链接
export PATH=/usr/local/opt/[email protected]/libexec/bin:$PATH
这里要注意你自己操作系统安装的Python的版本可能和我不同。
标签:OSX,Python,3.12,python,MAC,usr,local,python3 From: https://www.cnblogs.com/WestContinent/p/18134754