You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

安装easyocr后导入失败,出现[WinError 126] "The specified module could not be found"错误寻求解决方案

Fixing WinError 126 When Importing EasyOCR on Windows

Hey Toni, sorry to hear you're stuck with this WinError 126—this error almost always points to a missing system dependency or a misaligned library installation, not an issue with EasyOCR itself. Let's work through the most reliable fixes step by step:

  • Install/Update Microsoft Visual C++ Redistributable
    EasyOCR relies on several low-level libraries that require the VC++ runtime. Grab the x64 version of the Microsoft Visual C++ Redistributable for Visual Studio 2015-2022 (search for it directly in your browser), run the installer, restart your computer, then try importing EasyOCR again.

  • Reinstall EasyOCR with a Stable Version
    Sometimes newer versions have compatibility quirks with certain Windows/Python combinations. Uninstall your current version first:

    pip uninstall easyocr -y
    

    Then install a known-stable version like 1.6.2:

    pip install easyocr==1.6.2
    
  • Ensure PyTorch is Properly Installed
    EasyOCR depends heavily on PyTorch, and a broken PyTorch setup can trigger this error. Uninstall existing PyTorch packages first:

    pip uninstall torch torchvision torchaudio -y
    

    Then install the version matching your system. For CPU-only setups:

    pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
    

    If you have an NVIDIA GPU with CUDA 11.8, use:

    pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
    

    After setting up PyTorch, reinstall EasyOCR.

  • Check for Missing DLL Files
    The error references a missing module, which is often a DLL. Navigate to your Python's Lib\site-packages\easyocr folder and check if key files (like opencv_world455.dll or vcruntime140.dll) are present. If any are missing:

    1. Search for the DLL on your system using Windows search
    2. Copy it to the easyocr folder, or to your C:\Windows\System32 directory
  • Test in a Clean Virtual Environment
    Global Python environments often have conflicting dependencies. Create a fresh virtual environment to isolate EasyOCR:

    python -m venv easyocr_env
    easyocr_env\Scripts\activate
    pip install easyocr==1.6.2
    

    Try importing EasyOCR inside this environment.

If none of these steps work, feel free to share your Python version, EasyOCR version, and Windows build number—those details can help narrow down the issue further.

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

火山引擎 最新活动