ubuntu16.04 python2.7安装opencv失败

在尝试使用pip安装OpenCV-Python时遇到了错误,报错信息显示为'NoneType' object is not iterable。这通常是由于版本不兼容或者配置问题导致的。解决方案是降低OpenCV库的版本,例如安装4.1.1.26版本,通过命令`pip install opencv-python==4.1.1.26`进行安装。
摘要由CSDN通过智能技术生成

报错信息

  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python /home/john/.local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp5B9JuH
       cwd: /tmp/pip-install-2R0BLk/opencv-python
  Complete output (22 lines):
  Traceback (most recent call last):
    File "/home/john/.local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
      main()
    File "/home/john/.local/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/john/.local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/usr/local/lib/python2.7/dist-packages/setuptools/build_meta.py", line 146, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "/usr/local/lib/python2.7/dist-packages/setuptools/build_meta.py", line 127, in _get_build_requires
      self.run_setup()
    File "/usr/local/lib/python2.7/dist-packages/setuptools/build_meta.py", line 243, in run_setup
      self).run_setup(setup_script=setup_script)
    File "/usr/local/lib/python2.7/dist-packages/setuptools/build_meta.py", line 142, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 448, in <module>
      main()
    File "setup.py", line 99, in main
      % {"ext": re.escape(sysconfig.get_config_var("EXT_SUFFIX"))}
    File "/usr/lib/python2.7/re.py", line 210, in escape
      s = list(pattern)
  TypeError: 'NoneType' object is not iterable

解决方案

版本太高或个边版本问题

pip install opencv-python==4.1.1.26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Alex-Leung

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值