python+opencv配置环境

python+opencv配置环境

  • python+opencv配置环境
    • 方法一:pip3 install opencv-python
      • 安装
      • 遇到的报错
    • 方法二:brew install opencv

python+opencv配置环境

方法一:pip3 install opencv-python

安装

在执行pip3 install opencv-python命令时会出现一些报错,需要执行以下命令。
(或许下面有一些命令是不需要的)

 pip3 install numpy
 pip3 install --upgrade setuptools
 pip3 install numpy Matplotlib
 pip3 install scikit-build
 export PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1
 pip3 install cmake
 pip3 install opencv-python

遇到的报错

  1. Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-hs72064x/opencv-python/
 pip3 install scikit-build
  1. Running setup.py bdist_wheel for opencv-python … error
    Complete output from command /usr/bin/python3 -u -c “import setuptools, tokenize;_file_=’/tmp/pip-build-t8nqvsw0/opencv-python/setup.py’;f=getattr(tokenize, ‘open’, open)(_file_);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, _file_, ‘exec’))” bdist_wheel -d /tmp/tmpd54lbiv6pip-wheel- --python-tag cp36:
    “Problem with the CMake installation, aborting build. CMake executable is %s” % cmake_executable)
    Problem with the CMake installation, aborting build. CMake executable is cmake
    Failed building wheel for opencv-python
    Running setup.py clean for opencv-python
    Failed to build opencv-python
    Installing collected packages: numpy, opencv-python
    Running setup.py install for opencv-python … error
pip3 install cmake

方法二:brew install opencv

这个方法的前提是要安装homebrew,这个第三方软件包的安装方法见MacBook配置homebrew等
安装完成后

brew install opencv
echo /usr/local/Cellar/opencv/【下载的版本号】/lib/python3.8/site-packages/ >> /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/cv2.pth

你可能感兴趣的:(安装配置,python,opencv)