欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Windows安装tessreocr踩雷

程序员文章站 2022-05-27 14:41:54
...

用Anaconda安装的Python环境,安装tesserocr时报错,tesserocr.cpp(555): fatal error C1083: Cannot open include file: 'leptonica/allheaders.h': No such file or directory

C:\Users\Administrator>pip install tesserocr pillow
Collecting tesserocr
  Using cached https://files.pythonhosted.org/packages/cf/0d/9e554f041962b8dd7ac
d978330535fed879452bb0af257c287ca4ae9c525/tesserocr-2.2.2.tar.gz
Requirement already satisfied: pillow in d:\programdata\anaconda3\lib\site-packa
ges (5.0.0)
Building wheels for collected packages: tesserocr
  Running setup.py bdist_wheel for tesserocr ... error
  Complete output from command d:\programdata\anaconda3\python.exe -u -c "import
 setuptools, tokenize;__file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-i
nstall-qo9ktk0e\\tesserocr\\setup.py';f=getattr(tokenize, 'open', open)(__file__
);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'ex
ec'))" bdist_wheel -d C:\Users\ADMINI~1\AppData\Local\Temp\pip-wheel-_vovqp88 --
python-tag cp36:
  Supporting tesseract v3.05.01
  Building with configs: {'libraries': ['tesseract', 'lept'], 'cython_compile_ti
me_env': {'TESSERACT_VERSION': 197889}}
  running bdist_wheel
  running build
  running build_ext
  building 'tesserocr' extension
  creating build
  creating build\temp.win-amd64-3.6
  creating build\temp.win-amd64-3.6\Release
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c
 /nologo /Ox /W3 /GL /DNDEBUG /MD -Id:\programdata\anaconda3\include -Id:\progra
mdata\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\V
C\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt"
"-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (
x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\inc
lude\winrt" /EHsc /Tptesserocr.cpp /Fobuild\temp.win-amd64-3.6\Release\tesserocr
.obj
  tesserocr.cpp
  tesserocr.cpp(555): fatal error C1083: Cannot open include file: 'leptonica/al
lheaders.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN
\\x86_amd64\\cl.exe' failed with exit status 2

  ----------------------------------------
  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 d:\programdata\anaconda3\python.exe -u -c "impo
rt setuptools, tokenize;__file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip
-install-qo9ktk0e\\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\ADMINI~1\AppData\Local\Temp\pip-record-hal0op
96\install-record.txt --single-version-externally-managed --compile:
    Supporting tesseract v3.05.01
    Building with configs: {'libraries': ['tesseract', 'lept'], 'cython_compile_
time_env': {'TESSERACT_VERSION': 197889}}
    running install
    running build
    running build_ext
    building 'tesserocr' extension
    creating build
    creating build\temp.win-amd64-3.6
    creating build\temp.win-amd64-3.6\Release
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MD -Id:\programdata\anaconda3\include -Id:\prog
ramdata\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0
\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt
" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files
 (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\i
nclude\winrt" /EHsc /Tptesserocr.cpp /Fobuild\temp.win-amd64-3.6\Release\tessero
cr.obj
    tesserocr.cpp
    tesserocr.cpp(555): fatal error C1083: Cannot open include file: 'leptonica/
allheaders.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\B
IN\\x86_amd64\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "d:\programdata\anaconda3\python.exe -u -c "import setuptools, tokenize;
__file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-qo9ktk0e\\tesse
rocr\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replac
e('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --recor
d C:\Users\ADMINI~1\AppData\Local\Temp\pip-record-hal0op96\install-record.txt --
single-version-externally-managed --compile" failed with error code 1 in C:\User
s\ADMINI~1\AppData\Local\Temp\pip-install-qo9ktk0e\tesserocr\
解决方法:cmd中输入命令  conda install -c simonflueckiger tesserocr