安装easyocr后导入失败,出现[WinError 126] "The specified module could not be found"错误寻求解决方案
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 -yThen install a known-stable version like 1.6.2:
pip install easyocr==1.6.2Ensure 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 -yThen install the version matching your system. For CPU-only setups:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpuIf you have an NVIDIA GPU with CUDA 11.8, use:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118After 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'sLib\site-packages\easyocrfolder and check if key files (likeopencv_world455.dllorvcruntime140.dll) are present. If any are missing:- Search for the DLL on your system using Windows search
- Copy it to the
easyocrfolder, or to yourC:\Windows\System32directory
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.2Try 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




