python - Brew 升级 python 返回 "python not installed"

标签 python python-3.x macos homebrew

我正在尝试使用 $ brew upgrade python 从“Python 3.7.3”升级到“Python 3.8”。但是当我尝试时,brew 返回:

Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
Updated 2 formulae.

Error: python not installed

我知道 python 已安装,因为我已经使用它几个月了。我可以通过运行 which python3

来确认这一点
/usr/bin/python3

python3 --version,

Python 3.7.3

我不知道是什么原因造成的?

问题可能是 python --version 仍然指向 python2,Python 2.7.16


更新

我还确认我已经运行了 brew cleanupbrew doctor

brew info python 返回

python@3.8: stable 3.8.5 (bottled)
Interpreted, interactive, object-oriented programming language
https://www.python.org/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/python@3.8.rb
License: Python-2.0
==> Dependencies
Build: pkg-config ✔
Required: gdbm ✔, openssl@1.1 ✔, readline ✔, 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/python@3.8/libexec/bin

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.8/site-packages

See: https://docs.brew.sh/Homebrew-and-Python
==> Analytics
install: 587,815 (30 days), 1,615,984 (90 days), 2,710,078 (365 days)
install-on-request: 187,760 (30 days), 307,168 (90 days), 343,355 (365 days)
build-error: 0 (30 days)

最佳答案

解决方案是用 brew 安装 python。

brew install python

我以为它已经安装了,但那是系统(不是 brew)版本。

错误,Error: python not installed 暗示 python 没有安装 brew。

关于python - Brew 升级 python 返回 "python not installed",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63525659/

相关文章:

python - Bokeh 在 Raspberry Pi 上找不到条形图模块

macos - 如何更改所有类型的基于文本的文件的默认文本编辑器,无论扩展名是什么?

Python日期生成

python - 我什么时候应该使用临时文件

python - 在 python 中添加年份

performance - 使用框阴影时站点速度极慢,但仅在 Mac 上?

macos - Mac 机器唤醒时运行函数

python - 将多行字符串转换为数据框

python - 值错误: Invalid dataset identifier (invalid dataset identifier)

python-3.x - 类型错误 : '<' not supported between instances of 'str' and 'int' in version numbers