pip install opencv-python出错 Getting requirements to build wheel ... No module named ‘skbuild‘等

pip install opencv-python
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting opencv-python
  Using cached opencv-python-4.3.0.38.tar.gz (88.0 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /home/xh/anaconda2/bin/python /home/xh/anaconda2/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpAZ4BqU
       cwd: /tmp/pip-install-P48yvX/opencv-python
  Complete output (22 lines):
  Traceback (most recent call last):
    File "/home/xh/anaconda2/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in 
      main()
    File "/home/xh/anaconda2/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/home/xh/anaconda2/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/tmp/pip-build-env-WtD_GQ/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 146, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "/tmp/pip-build-env-WtD_GQ/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 127, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-WtD_GQ/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 243, in run_setup
      self).run_setup(setup_script=setup_script)
    File "/tmp/pip-build-env-WtD_GQ/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 142, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 448, in 
      main()
    File "setup.py", line 99, in main
      % {"ext": re.escape(sysconfig.get_config_var("EXT_SUFFIX"))}
    File "/home/xh/anaconda2/lib/python2.7/re.py", line 210, in escape
      s = list(pattern)
  TypeError: 'NoneType' object is not iterable

解决办法更新pip

python -m pip install --upgrade pip

解决办法,因为是默认下载最新版本,降低opencv-python版本(目前以下版本可行)

pip install opencv-python==4.1.1.26
pip install opencv-python==4.1.1.26
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting opencv-python==4.1.1.26
  Downloading opencv_python-4.1.1.26-cp27-cp27mu-manylinux1_x86_64.whl (28.7 MB)
     |████████████████████████████████| 28.7 MB 132 kB/s 
Requirement already satisfied: numpy>=1.11.1 in ./anaconda2/lib/python2.7/site-packages (from opencv-python==4.1.1.26) (1.16.6)
Installing collected packages: opencv-python
Successfully installed opencv-python-4.1.1.26

成功安装!

你可能感兴趣的:(python,opencv,开发语言)