You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

虚拟环境中pip安装OpenCV时出现TLS协议版本错误求助

Fixing SSL/TLS Error When Installing opencv-python in TensorFlow Virtual Env

Hey there, let's work through this install error you're seeing. The root of the problem is two-fold:

  • Your pip version is outdated, so it doesn't support the newer TLS protocols that PyPI now requires (PyPI dropped support for TLS 1.0/1.1 a while back)
  • There's a corrupted pip cache entry that's causing extra issues

Here's how to fix it step by step:

  1. Upgrade pip to the latest version first
    Outdated pip is the main culprit here—newer versions use TLS 1.2+ which PyPI accepts. Run this in your TensorFlow virtual environment:

    pip install --upgrade pip
    

    If you still hit SSL errors while upgrading pip, you can bypass the SSL check temporarily for this step (only do this once, as it's less secure):

    pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org
    
  2. Clear the corrupted pip cache
    The "Cache entry deserialization failed" message means some cached data is broken. Clear the entire pip cache with:

    pip cache purge
    
  3. Install opencv-python again
    Now that pip is updated and the cache is clean, try installing opencv-python once more:

    pip install opencv-python
    

    If you're still facing network issues (like slow downloads or regional blocks), you can use a trusted domestic PyPI mirror by adding -i [mirror URL] to the install command—look up reputable mirrors in your region for the exact address.

That should resolve both the SSL/TLS protocol error and the cache deserialization issue. Let me know if you run into any other snags!

内容的提问来源于stack exchange,提问作者Andy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 04:18:03