[英]What is the difference between Python in /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 and in /usr/local/bin/python3
I recently formatted my Macbook and I only remember downloading Python3 once.我最近格式化了我的 Macbook,我只记得下载过一次 Python3。 So when I went to change my interpreter path, it shows 2 different Python3 paths.所以当我去改变我的解释器路径时,它显示了 2 个不同的 Python3 路径。 I'm aware that the one on top is installed on my system by default, but as for the bottom two, I'm not too sure what are the differences between them.我知道顶部的那个默认安装在我的系统上,但至于底部的两个,我不太确定它们之间有什么区别。
The 1st one (Python2.7) is the system default/built-in Python.第一个(Python2.7)是系统默认/内置Python。
The middle one (Python3, /Library/Frameworks/Python.framework/
) is what you usually get when you install Python from the Python Releases for Mac OS X downloads page from python.org, using the macOS installer (something like a python-3.8.7-macosx10.9-1.pkg
). The middle one (Python3, /Library/Frameworks/Python.framework/
) is what you usually get when you install Python from the Python Releases for Mac OS X downloads page from python.org, using the macOS installer (something like a python-3.8.7-macosx10.9-1.pkg
)。
The bottom one (Python3, /usr/local/bin/python3
) is what you usually get when you use Homebrew to install Python: https://docs.brew.sh/Homebrew-and-Python .底部的(Python3, /usr/local/bin/python3
)是您使用 Homebrew 安装 Python 时通常得到的: https://docs.brew.sh/Homebrew-and-Python 。
~$ brew info python3
python@3.9: stable 3.9.1 (bottled)
...
Python has been installed as
/usr/local/bin/python3
...
You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/usr/local/lib/python3.9/site-packages
See: https://docs.brew.sh/Homebrew-and-Python
There is no difference in terms of functionality between the python.org one and the Homebrew one. python.org 和 Homebrew 之间的功能没有区别。 If you installed the same version, they should work the same.如果您安装了相同的版本,它们的工作方式应该相同。 The only difference, aside from the paths, is when you need to upgrade and/or remove your installation (ex. going from python3.8 to python3.9), something easily done with Homebrew using brew upgrade python3
and brew uninstall python3
.除了路径之外,唯一的区别是当您需要升级和/或删除您的安装(例如从 python3.8 到 python3.9)时,使用 Homebrew 使用brew upgrade python3
和brew uninstall python3
可以轻松完成。
As to why VS Code finds those Python interpreters, see the section on the VS Code docs for where the extension looks for environments , which lists among those " Standard install paths such as /usr/local/bin
, /usr/sbin
, /sbin
, c:\\python27
, c:\\python36
, etc ".至于为什么 VS Code 会找到那些 Python 解释器,请参阅 VS Code 文档中有关扩展查找环境的部分,其中列出了“标准安装路径,例如/usr/local/bin
、 /usr/sbin
、 /sbin
, c:\\python27
\\python27 , c:\\python36
等"。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.