在Windows 10上安装tesserocr pip会出错

时间:2017-05-12 10:01:27

标签: python ocr tesseract python-tesseract

我正在尝试在Windows10主机操作系统上安装python的tesserocr包 我收到了以下错误

 pip install tesserocr

执行

 pip install tesserocr
Collecting tesserocr
  Using cached tesserocr-2.1.3.tar.gz
Building wheels for collected packages: tesserocr
  Running setup.py bdist_wheel for tesserocr ... error
  Complete output from command "C:\Program Files\Anaconda3\python.exe" -u -c 
"import setuptools, 
tokenize;__file__='C:\\Users\\hp\\AppData\\Local\\Temp\\pip-build-
klj3zdup\\tesserocr\\setup.py';f=getattr(tokenize, 'open', open)
(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, 
__file__, 'exec'))" bdist_wheel -d 
C:\Users\hp\AppData\Local\Temp\tmpoyt9eh40pip-wheel- --python-tag cp35:
  running bdist_wheel
  running build
  running build_ext
  Failed to extract tesseract version from executable: [WinError 2] The 
system cannot find the file specified
  Supporting tesseract v3.04.00
  Building with configs: {'libraries': ['tesseract', 'lept'], 
'cython_compile_time_env': {'TESSERACT_VERSION': 197632}}
  cythoning tesserocr.pyx to tesserocr.cpp
  building 'tesserocr' extension
  error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft 
Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-
build-tools

  ----------------------------------------
  Failed building wheel for tesserocr
  Running setup.py clean for tesserocr
Failed to build tesserocr
Installing collected packages: tesserocr
  Running setup.py install for tesserocr ... error
    Complete output from command "C:\Program Files\Anaconda3\python.exe" -u 
-c "import setuptools, 
tokenize;__file__='C:\\Users\\hp\\AppData\\Local\\Temp\\pip-build-
klj3zdup\\tesserocr\\setup.py';f=getattr(tokenize, 'open', open)
(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, 
__file__, 'exec'))" install --record C:\Users\hp\AppData\Local\Temp\pip-
10ema0ny-record\install-record.txt --single-version-externally-managed --
compile:
running install
running build
running build_ext
Failed to extract tesseract version from executable: [WinError 2] The system cannot find the file specified
Supporting tesseract v3.04.00
Building with configs: {'cython_compile_time_env': {'TESSERACT_VERSION': 197632}, 'libraries': ['tesseract', 'lept']}
skipping 'tesserocr.cpp' Cython extension (up-to-date)
building 'tesserocr' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

----------------------------------------
Command ""C:\Program Files\Anaconda3\python.exe" -u -c "import setuptools, 
tokenize;__file__='C:\\Users\\hp\\AppData\\Local\\Temp\\pip-build-
klj3zdup\\tesserocr\\setup.py';f=getattr(tokenize, 'open', open)
(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, 
__file__, 'exec'))" install --record C:\Users\hp\AppData\Local\Temp\pip-
10ema0ny-record\install-record.txt --single-version-externally-managed --
compile" failed with error code 1 in C:\Users\hp\AppData\Local\Temp\pip-
build-klj3zdup\tesserocr\

如何克服这个问题?

2 个答案:

答案 0 :(得分:0)

正如您从错误日志中看到的,此处的问题是您的计算机上缺少Microsoft Visual C++ 14.0

要解决此问题,只需安装它,按照在追踪(this one)中找到的链接,然后使用命令再次尝试

pip install tesserocr

答案 1 :(得分:0)

使用Anaconda直接重新加载Python,并使用:

.squares .square {
  width: 200px;
  text-align: center;
  height: 200px;
  background-color: white;
  border-radius: 15px;
}