python安装cv2包报错解决方法

这篇具有很好参考价值的文章主要介绍了python安装cv2包报错解决方法。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

1.在pycharm中安装cv2包报错

ERROR: Could not find a version that satisfies the requirement cv2 (from versions: none)
ERROR: No matching distribution found for cv2
WARNING: You are using pip version 21.3.1; however, version 22.0.3 is available.
You should consider upgrading via the 'C:\Program Files\Python310\python.exe -m pip install --upgrade pip' command.

这里报错pip版本低了,需要升级pip

2.然后去控制台升级pip,升级完去安装cv2,控制台继续报错

ERROR: Could not find a version that satisfies the requirement cv2 (from versions: none)
ERROR: No matching distribution found for cv2

解决方法:安装未成功,然后百度查找相关资料,说是压根没有cv2的包,实际上需要安装的是一个叫opencv-python的包

pip install opencv-python

因为网络原因,导致时间超出,出现了如下错误:

ERROR: Exception:
Traceback (most recent call last):
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\urllib3\response.py", line 438, in _error_catcher
    yield
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\urllib3\response.py", line 519, in read
    data = self._fp.read(amt) if not fp_closed else b""
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 90, in read
    data = self.__fp.read(amt)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\http\client.py", line 465, in read
    s = self.fp.read(amt)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\socket.py", line 705, in readinto
    return self._sock.recv_into(b)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\ssl.py", line 1273, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\ssl.py", line 1129, in read
    return self._sslobj.read(len, buffer)
TimeoutError: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\cli\base_command.py", line 167, in exc_logging_wrapper
    status = run_func(*args)
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\cli\req_command.py", line 205, in wrapper
    return func(self, options, args)
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\commands\install.py", line 339, in run
    requirement_set = resolver.resolve(
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 94, in resolve
    result = self._result = resolver.resolve(
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\resolvelib\resolvers.py", line 481, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\resolvelib\resolvers.py", line 348, in resolve
    self._add_to_criteria(self.state.criteria, r, parent=None)
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\resolvelib\resolvers.py", line 172, in _add_to_criteria
    if not criterion.candidates:
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\resolvelib\structs.py", line 151, in __bool__
    return bool(self._sequence)
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 155, in __bool__
    return any(self)
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 143, in <genexpr>
    return (c for c in iterator if id(c) not in self._incompatible_ids)
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 47, in _iter_built
    candidate = func()
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 215, in _make_candidate_from_link
    self._link_candidate_cache[link] = LinkCandidate(
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 288, in __init__
    super().__init__(
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 158, in __init__
    self.dist = self._prepare()
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 227, in _prepare
    dist = self._prepare_distribution()
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 299, in _prepare_distribution
    return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\operations\prepare.py", line 487, in prepare_linked_requirement
    return self._prepare_linked_requirement(req, parallel_builds)
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\operations\prepare.py", line 532, in _prepare_linked_requirement
    local_file = unpack_url(
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\operations\prepare.py", line 214, in unpack_url
    file = get_http_url(
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\operations\prepare.py", line 94, in get_http_url
    from_path, content_type = download(link, temp_dir.path)
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\network\download.py", line 146, in __call__
    for chunk in chunks:
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\cli\progress_bars.py", line 304, in _rich_progress_bar
    for chunk in iterable:
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_internal\network\utils.py", line 63, in response_chunks
    for chunk in response.raw.stream(
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\urllib3\response.py", line 576, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\urllib3\response.py", line 512, in read
    with self._error_catcher():
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.752.0_x64__qbz5n2kfra8p0\lib\contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "C:\Users\thorne\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip\_vendor\urllib3\response.py", line 443, in _error_catcher
    raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

3. pip install --default-timeout=1000 opencv-python(如果不能正确安装可以多试几次文章来源地址https://www.toymoban.com/news/detail-457622.html

到了这里,关于python安装cv2包报错解决方法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • python 安装 cv2报错 conda install PackagesNotFoundError

    报错如下:Collecting package metadata (current_repodata.json): done Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve. Collecting package metadata (repodata.json): done Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve. PackagesNotFoundError: The following

    2024年02月03日
    浏览(41)
  • pycharm安装CV2

    一开始因为我的python版本(3.9)过高 报错: The symbol module is deprecated and will be removed in future versions of Python from symbol import parameters 即  symbol 模块被3.9弃用 文档中查到3.8与3.7都还可以使用,所以重新安装了一下python3.7,并配置到pycharm中。 symbol --- 与 Python 解析树一起使用的常量

    2024年02月05日
    浏览(37)
  • cv2导入失败原因及安装opencv后仍报错的解决方式

            对于python而言,在引用opencv库的时候需要写为import cv2。其中,cv2是opencv的C++命名空间名称,使用它来表示调用的是C++开发的opencv的接口。如果没有下载opencv库的话,直接导入cv2会报错:ModuleNotFoundError:No module named \\\'cv2\\\'。         直接pip install cv2是不行的,会报错

    2024年02月05日
    浏览(131)
  • Python安装包报错ERROR: Could not find a version that satisfies the requirement XXX解决方法

    我们在使用 pip 安装 python 包时,经常会出现如下错误: 找了很久终于找到能解决这种报错的方法了。 直接选用pip源并且信任它的来源就可以解决这种问题。 上面使用了豆瓣源,将其换成清华源、阿里源等都适用。 清华源: Simple Index

    2024年02月11日
    浏览(58)
  • pycharm 安装cv2( opencv)

    项目创建建议是虚拟环境 ,这样不会因为之前下载的某些包模块版本不同导致运行出现问题,很多人下载不了或者报错都是因为环境问题所以直接虚拟环境。  成本cv2 报错   pip install opencv-python  完成查看 更新pip (下载不成功更新一下  pip )  完成下一个代码展示一下怎么

    2024年02月16日
    浏览(40)
  • pycharm 无法加载pip3安装包报错:python packing tools not found. install packing tools

    win+R输入cmd,然后输入代码,回车,出现install sucessfully表示成功 Python 2.7.9 + 或 Python 3.4+ 以上版本都自带 pip 工具。 查看是否已经安装 pip 可以使用以下命令: 下载安装包使用以下命令: 例如我们安装 numpy 包: 我们也可以轻易地通过以下的命令来移除软件包: 例如我们移除

    2024年02月05日
    浏览(53)
  • Mac安装opencv后无法导入cv2的解决方法

    前提条件 :以下两个插件安装成功 pip install opencv-python pip install --user opencv-contrib-python 注:直接用pip install opencv-contrib-python如果报错,就加上“–user\\\" 第一步: 设置–添加python解释器 第二步: 安装了Anaconda3,就去该目录中找到python的解释器,点击右上角,Add 为了区分其他解

    2024年02月12日
    浏览(44)
  • Python pip install 安装包报错ERROR: Could not find a version that satisfies the requirement XXX解决方法

    使用 pip 安装 python 包时,经常会出现如下错误: 本次在用pip命令(pip install pdf2word)安装pdf2docx包的时候出错 因为后来安装好了,所以故意安装一个错误的pdf2word,来整个图 可能是国内网络不稳定,直接导致报错,而不是环境冲突。报错信息看起来容易把人误导到解决包环境

    2024年01月18日
    浏览(92)
  • Pycharm安装cv2第三方库失败

            在百度上查询资料,不存在cv2库,实际需要安装的是名为opencv-python的库。         直接在Terminal界面输入:pip install opencv-python即可安装了。

    2024年02月11日
    浏览(49)
  • 解决python3安装完OpenCV后没有cv2.imshow、cv2.imread等函数的问题

    发现cv2中没有函数可用,此时打开cv2所在的文件夹, 找到 cv2.pyd 文件,复制到所用python环境中的site-packages文件夹中 关闭项目工程文件重新打开,就可以调用cv2中的函数了。

    2024年02月03日
    浏览(79)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包