解决windows安装tesserocr报错问题 Failed building wheel for tesserocr
Posted chl434723646
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决windows安装tesserocr报错问题 Failed building wheel for tesserocr相关的知识,希望对你有一定的参考价值。
在我安装tesserocr的过程中出现了报错
C:UsersAdministrator>pip3 install tesserocr pillow
Collecting tesserocr
Using cached https://files.pythonhosted.org/packages/cf/0d/9e554f041962b8dd7acd978330535fed879452bb0af257c287ca4ae9c525/tesserocr-2.2.2.tar.gz
Requirement already satisfied: pillow in d:anacondalibsite-packages (5.0.0)
Building wheels for collected packages: tesserocr
Running setup.py bdist_wheel for tesserocr ... error
Complete output from command d:anacondapython.exe -u -c "import setuptools, tokenize;__file__=‘C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-i9u0iczd\tesserocr\setup.py‘;f=getattr(tokenize, ‘open‘, open)(__file__);code=f.read().replace(‘
‘, ‘
‘);f.close();exec(compile(code, __file__, ‘exec‘))" bdist_wheel -d C:UsersADMINI~1AppDataLocalTemppip-wheel-op2ibo5_ --python-tag cp36:
Supporting tesseract v3.05.01
Building with configs: {‘libraries‘: [‘tesseract‘, ‘lept‘], ‘cython_compile_time_env‘: {‘TESSERACT_VERSION‘: 197889}}
running bdist_wheel
running build
running build_ext
building ‘tesserocr‘ extension
creating build
creating build emp.win-amd64-3.6
creating build emp.win-amd64-3.6Release
C:Program Files (x86)Microsoft Visual Studio2017ProfessionalVCToolsMSVC14.12.25827inHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Id:anacondainclude -Id:anacondainclude "-IC:Program Files (x86)Microsoft Visual Studio2017ProfessionalVCToolsMSVC14.12.25827ATLMFCinclude" "-IC:Program Files (x86)Microsoft Visual Studio2017ProfessionalVCToolsMSVC14.12.25827include" "-IC:Program Files (x86)Windows KitsNETFXSDK4.6.1includeum" "-IC:Program Files (x86)Windows Kits10include10.0.16299.0ucrt" "-IC:Program Files (x86)Windows Kits10include10.0.16299.0shared" "-IC:Program Files (x86)Windows Kits10include10.0.16299.0um" "-IC:Program Files (x86)Windows Kits10include10.0.16299.0winrt" /EHsc /Tptesserocr.cpp /Fobuild emp.win-amd64-3.6Release esserocr.obj
tesserocr.cpp
tesserocr.cpp(555): fatal error C1083: 无法打开包括文件: “leptonica/allheaders.h”: No such file or directory
error: command ‘C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\bin\HostX86\x64\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:anacondapython.exe -u -c "import setuptools, tokenize;__file__=‘C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-i9u0iczd\tesserocr\setup.py‘;f=getattr(tokenize, ‘open‘, open)(__file__);code=f.read().replace(‘
‘, ‘
‘);f.close();exec(compile(code, __file__, ‘exec‘))" install --record C:UsersADMINI~1AppDataLocalTemppip-record-1olmw2pcinstall-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 emp.win-amd64-3.6
creating build emp.win-amd64-3.6Release
C:Program Files (x86)Microsoft Visual Studio2017ProfessionalVCToolsMSVC14.12.25827inHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Id:anacondainclude -Id:anacondainclude "-IC:Program Files (x86)Microsoft Visual Studio2017ProfessionalVCToolsMSVC14.12.25827ATLMFCinclude" "-IC:Program Files (x86)Microsoft Visual Studio2017ProfessionalVCToolsMSVC14.12.25827include" "-IC:Program Files (x86)Windows KitsNETFXSDK4.6.1includeum" "-IC:Program Files (x86)Windows Kits10include10.0.16299.0ucrt" "-IC:Program Files (x86)Windows Kits10include10.0.16299.0shared" "-IC:Program Files (x86)Windows Kits10include10.0.16299.0um" "-IC:Program Files (x86)Windows Kits10include10.0.16299.0winrt" /EHsc /Tptesserocr.cpp /Fobuild emp.win-amd64-3.6Release esserocr.obj
tesserocr.cpp
tesserocr.cpp(555): fatal error C1083: 无法打开包括文件: “leptonica/allheaders.h”: No such file or directory
error: command ‘C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\bin\HostX86\x64\cl.exe‘ failed with exit status 2
----------------------------------------
Command "d:anacondapython.exe -u -c "import setuptools, tokenize;__file__=‘C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-i9u0iczd\tesserocr\setup.py‘;f=getattr(tokenize, ‘open‘, open)(__file__);code=f.read().replace(‘
‘, ‘
‘);f.close();exec(compile(code, __file__, ‘exec‘))" install --record C:UsersADMINI~1AppDataLocalTemppip-record-1olmw2pcinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersADMINI~1AppDataLocalTemppip-install-i9u0iczd esserocr
报错如上图所示,我初期也不懂到底是什么问题引起的,之后我看了下网上的搜索结果,发现原来是我安装了Anaconda的原因。同时,也找到了解决方法
解决方法就是在cmd中输入
conda install -c simonflueckiger tesserocr
查了下conda install 发现conda是针对于python的。可以安装minconda或anaconda进行安装。所以在安装了Anaconda的条件下,我们可以通过conda install安装tesserocr
参考链接
https://blog.csdn.net/koflance/article/details/78582737
https://blog.csdn.net/badman_h/article/details/80320625
以上是关于解决windows安装tesserocr报错问题 Failed building wheel for tesserocr的主要内容,如果未能解决你的问题,请参考以下文章
安装tesserocr的步骤和报错RuntimeError: Failed to init API, possibly an invalid tessdata path解决办法