我正在编写一个程序,将视频分成帧,并使用opencv-python和pytesseract提取每n帧的文本。我设法使代码工作,但程序工作得相当慢。我尝试使用PyPy3来提高性能,但在为pypy安装opencv库时遇到了一个问题。
这是错误代码:
Collecting opencv-python
Using cached opencv-python-4.6.0.66.tar.gz (90.3 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: numpy>=1.14.5 in /usr/local/Cellar/pypy3/7.3.9/libexec/site-packages (from opencv-python) (1.21.6)
Building wheels for collected packages: opencv-python
Building wheel for opencv-python (pyproject.toml): started
Building wheel for opencv-python (pyproject.toml): finished with status 'error'
Failed to build opencv-python
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
error: subprocess-exited-with-error
× Building wheel for opencv-python (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [9 lines of output]
Traceback (most recent call last):
File "/private/var/folders/55/4bdtvdzn54n8npg5kfybcvq40000gp/T/pip-build-env-_2gw8fsy/overlay/site-packages/skbuild/setuptools_wrap.py", line 613, in setup
cmkr = cmaker.CMaker(cmake_executable)
File "/private/var/folders/55/4bdtvdzn54n8npg5kfybcvq40000gp/T/pip-build-env-_2gw8fsy/overlay/site-packages/skbuild/cmaker.py", line 141, in __init__
self.cmake_version = get_cmake_version(self.cmake_executable)
File "/private/var/folders/55/4bdtvdzn54n8npg5kfybcvq40000gp/T/pip-build-env-_2gw8fsy/overlay/site-packages/skbuild/cmaker.py", line 96, in get_cmake_version
"Problem with the CMake installation, aborting build. CMake executable is %s" % cmake_executable
Problem with the CMake installation, aborting build. CMake executable is cmake
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for opencv-python
ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects
我觉得我什么都试过了。我使用
成功安装了所有其他依赖项pypy3 -m pip install [package]
是的,我已经把我的pip, setuptools和wheels升级到最新版本了。
其他相关信息:
解释器路径:/usr/local/bin/pypy3
Python版本:PyPy 7.3.9 [Python 3.7.13]
操作系统:MacOS
我所理解的是,错误在于构建轮子,我读了一些关于自己构建包的东西。我也想不明白。如有任何帮助,不胜感激。
编辑:
我使用brew install cmake
安装了cmake。现在当我尝试安装opencv-python时,而不是引发ERROR, cmd被卡在Building wheel for opencv-python (pyproject.toml) ... |
错误提示可能链接到cmake,您可以尝试安装它。→https://cmake.org/install/