【发布时间】:2021-05-10 14:05:17
【问题描述】:
我在 Mac 上正确安装 Python 时遇到了困难(全新安装,我将 PC 擦干净)。我先安装了
- 家酿
- 通过 App Store 的 Xcode
- 使用命令的命令行工具:
"xcode-select --install"
在输入以下命令时:
which python3
输出如下:
gaurangsmacbookpro@Gaurangs-New-MacBook-Pro ~ % which python
/usr/bin/python
gaurangsmacbookpro@Gaurangs-New-MacBook-Pro ~ % which python3
/usr/bin/python3
在运行以下命令后,我从该站点的博客中关注了该命令: https://www.pyimagesearch.com/2016/12/05/macos-install-opencv-3-and-python-3-5/
brew install eigen tbb
Home brew 安装了 python 3.9 依赖项,所以当我键入以下命令时没有:
brew list python3
我得到以下输出:
gaurangsmacbookpro@Gaurangs-New-MacBook-Pro ~ % brew list python3
/usr/local/Cellar/python@3.9/3.9.1_8/bin/2to3
/usr/local/Cellar/python@3.9/3.9.1_8/bin/2to3-3.9
/usr/local/Cellar/python@3.9/3.9.1_8/bin/easy_install-3.9
/usr/local/Cellar/python@3.9/3.9.1_8/bin/idle3
/usr/local/Cellar/python@3.9/3.9.1_8/bin/idle3.9
/usr/local/Cellar/python@3.9/3.9.1_8/bin/pip3
/usr/local/Cellar/python@3.9/3.9.1_8/bin/pip3.9
/usr/local/Cellar/python@3.9/3.9.1_8/bin/pydoc3
/usr/local/Cellar/python@3.9/3.9.1_8/bin/pydoc3.9
/usr/local/Cellar/python@3.9/3.9.1_8/bin/python3
/usr/local/Cellar/python@3.9/3.9.1_8/bin/python3-config
/usr/local/Cellar/python@3.9/3.9.1_8/bin/python3.9
/usr/local/Cellar/python@3.9/3.9.1_8/bin/python3.9-config
/usr/local/Cellar/python@3.9/3.9.1_8/bin/wheel3
/usr/local/Cellar/python@3.9/3.9.1_8/Frameworks/Python.framework/ (3019 files)
/usr/local/Cellar/python@3.9/3.9.1_8/IDLE 3.app/Contents/ (8 files)
/usr/local/Cellar/python@3.9/3.9.1_8/lib/pkgconfig/ (4 files)
/usr/local/Cellar/python@3.9/3.9.1_8/libexec/bin/ (7 files)
/usr/local/Cellar/python@3.9/3.9.1_8/libexec/pip/ (480 files)
/usr/local/Cellar/python@3.9/3.9.1_8/libexec/setuptools/ (334 files)
/usr/local/Cellar/python@3.9/3.9.1_8/libexec/wheel/ (44 files)
/usr/local/Cellar/python@3.9/3.9.1_8/Python Launcher 3.app/Contents/ (16 files)
/usr/local/Cellar/python@3.9/3.9.1_8/share/man/ (2 files)
我的~./bash_profile文件内容如下:
# Add Homebrew's executable directory to the front of the PATH
export PATH=/usr/local/bin:$PATH
export PATH="/usr/local/sbin:$PATH"
export PATH="/usr/local/opt/python@3.8/bin:$PATH"
我做错了什么?我只想全新安装 Python 3.8 而不是 3.9,因为 3.9 上尚不支持 TF Lite。有人可以帮我解决这个烂摊子吗?我将不胜感激!
【问题讨论】:
-
我认为 3.9 没有任何重大变化,代码真的无法运行吗? 3.9 是目前的稳定版,到现在大约 6 个月。
-
当我上次尝试时,GitHub 存储库无法使用带有 python3.9 安装的“CMAKE”进行编译。 TF Lite 的网站也推荐 python 3.8.x
-
我很欣赏你所说的,伙计,但是当你用某个版本发布一些东西时,比如使用 python@3.8.2 的命令行工具,那么你最好确保它是世界真正想要的东西,这就是我要说的。但是,您发布的链接有帮助。但我又开始了。我从 brew 中删除了所有依赖项,然后再试一次!还是谢谢!
-
我通过完整备份我的工作文件并在 Mac 上重新开始解决了这个问题。现在似乎工作正常。当然是最后的手段。
标签: python python-3.x macos macos-big-sur