python3 在 macOS 安裝opencv-python失敗的解法

Posted in :

在 macOS 裡,安裝opencv-python 或 opencv-python-headless 時,一直裝不上,stackover 上找不到解法。

錯誤訊息:

ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects

從執行的畫面來看,應該是 pip 挑戰幫我的 macOS 10.15-x86_64 build 出一個執行檔,但失敗了。


I had the same problem and i did this,

pip install --upgrade pip setuptools wheel

then install opencv again,

pip install opencv-python

this not worked for me!

我最後解決了,解法:
https://cloud.tencent.com/developer/article/2221107

首先,先決定要安裝的是 opencv-python 或 opencv-python-headless , 這2個是獨立的套件,互不影響,如果你跟我一樣,是要跑 ddddocr, 那就是只要安裝後面的 opencv-python-headless 就可以了。

請點擊下面的網頁來下載 opencv-python-headless :
https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/opencv-python-headless/

如果是要下載 opencv-python-headless 就把上面的網址的 -headless 移除就可以了。

紅色框框,是我下載的 .whl 檔。

cp37 指最低要求是 python 3.7 ,

macosx_10_13 指最低要求是 macOS 10.13 版,由於我是用 10.15 版,所以不能下載 10_16 的版本。

用 intel CPU 請下載 x86_64, 用 arm CPU 請用 arm64 的版本。

下載好後使用 pip3 install 就可以完成安裝:

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *