解决windows安装tesserocr报错问题 Failed building wheel for tesserocr
在我安装tesserocr的过程中出现了报错
C:\Users\Administrator>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:\anaconda\lib\site-packages (5.0.0)
Building wheels for collected packages: tesserocr
Running setup.py bdist_wheel for tesserocr ... error
Complete output from command d:\anaconda\python.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(‘\r\n‘, ‘\n‘);f.close();exec(compile(code, __file__, ‘exec‘))" bdist_wheel -d C:\Users\ADMINI~1\AppData\Local\Temp\pip-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\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Id:\anaconda\include -Id:\anaconda\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" /EHsc /Tptesserocr.cpp /Fobuild\temp.win-amd64-3.6\Release\tesserocr.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:\anaconda\python.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(‘\r\n‘, ‘\n‘);f.close();exec(compile(code, __file__, ‘exec‘))" install --record C:\Users\ADMINI~1\AppData\Local\Temp\pip-record-1olmw2pc\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\2017\Professional\VC\Tools\MSVC\14.12.25827\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Id:\anaconda\include -Id:\anaconda\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" /EHsc /Tptesserocr.cpp /Fobuild\temp.win-amd64-3.6\Release\tesserocr.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:\anaconda\python.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(‘\r\n‘, ‘\n‘);f.close();exec(compile(code, __file__, ‘exec‘))" install --record C:\Users\ADMINI~1\AppData\Local\Temp\pip-record-1olmw2pc\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-i9u0iczd\tesserocr\
报错如上图所示,我初期也不懂到底是什么问题引起的,之后我看了下网上的搜索结果,发现原来是我安装了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