我已经有了 leptonica 和 tesseract 的最新版本
tesseract 4.00.00alpha-365-gcf0b378 leptonica-1.74.1 libjpeg 8d (libjpeg-turbo 1.3.0) : libpng 1.2.50 : libtiff 4.0.3 : zlib 1.2.8
我还安装了所有依赖项,例如 python-dev
这是我在 virtualenv 中执行 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 /home/ajay/virtualenvs/v2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-L3JmI9/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 /tmp/tmpUIPX1spip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_ext
Supporting tesseract v4.00.00dev
Configs from pkg-config: {'libraries': ['lept', 'tesseract'], 'cython_compile_time_env': {'TESSERACT_VERSION': 262144}, 'library_dirs': ['/usr/local/lib'], 'include_dirs': ['/usr/local/include']}
cythoning tesserocr.pyx to tesserocr.cpp
building 'tesserocr' extension
creating build
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -I/usr/local/include -fPIC -I/usr/local/include -I/usr/include/python2.7 -c tesserocr.cpp -o build/temp.linux-x86_64-2.7/tesserocr.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from /usr/local/include/tesseract/genericvector.h:29:0,
from tesserocr.cpp:449:
/usr/local/include/tesseract/helpers.h: In member function ‘void tesseract::TRand::set_seed(const string&)’:
/usr/local/include/tesseract/helpers.h:50:5: error: ‘hash’ is not a member of ‘std’
std::hash<std::string> hasher;
^
/usr/local/include/tesseract/helpers.h:50:26: error: expected primary-expression before ‘>’ token
std::hash<std::string> hasher;
^
/usr/local/include/tesseract/helpers.h:50:28: error: ‘hasher’ was not declared in this scope
std::hash<std::string> hasher;
^
tesserocr.cpp: In function ‘tesseract::TessResultRenderer* __pyx_f_9tesserocr_13PyTessBaseAPI__get_renderer(__pyx_obj_9tesserocr_PyTessBaseAPI*, __pyx_t_9tesseract_cchar_t*)’:
tesserocr.cpp:16699:106: error: no matching function for call to ‘tesseract::TessPDFRenderer::TessPDFRenderer(__pyx_t_9tesseract_cchar_t*&, const char*)’
__pyx_t_7 = new tesseract::TessPDFRenderer(__pyx_v_outputbase, __pyx_v_self->_baseapi.GetDatapath());
^
tesserocr.cpp:16699:106: note: candidates are:
In file included from tesserocr.cpp:459:0:
/usr/local/include/tesseract/renderer.h:190:3: note: tesseract::TessPDFRenderer::TessPDFRenderer(const char*, const char*, bool)
TessPDFRenderer(const char* outputbase, const char* datadir, bool textonly);
^
/usr/local/include/tesseract/renderer.h:190:3: note: candidate expects 3 arguments, 2 provided
/usr/local/include/tesseract/renderer.h:186:16: note: tesseract::TessPDFRenderer::TessPDFRenderer(const tesseract::TessPDFRenderer&)
class TESS_API TessPDFRenderer : public TessResultRenderer {
^
/usr/local/include/tesseract/renderer.h:186:16: note: candidate expects 1 argument, 2 provided
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
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 /home/ajay/virtualenvs/v2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-L3JmI9/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 /tmp/pip-6eGBXb-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/ajay/virtualenvs/v2/include/site/python2.7/tesserocr:
running install
running build
running build_ext
Supporting tesseract v4.00.00dev
Configs from pkg-config: {'libraries': ['lept', 'tesseract'], 'cython_compile_time_env': {'TESSERACT_VERSION': 262144}, 'library_dirs': ['/usr/local/lib'], 'include_dirs': ['/usr/local/include']}
skipping 'tesserocr.cpp' Cython extension (up-to-date)
building 'tesserocr' extension
creating build
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -I/usr/local/include -fPIC -I/usr/local/include -I/usr/include/python2.7 -c tesserocr.cpp -o build/temp.linux-x86_64-2.7/tesserocr.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from /usr/local/include/tesseract/genericvector.h:29:0,
from tesserocr.cpp:449:
/usr/local/include/tesseract/helpers.h: In member function ‘void tesseract::TRand::set_seed(const string&)’:
/usr/local/include/tesseract/helpers.h:50:5: error: ‘hash’ is not a member of ‘std’
std::hash<std::string> hasher;
^
/usr/local/include/tesseract/helpers.h:50:26: error: expected primary-expression before ‘>’ token
std::hash<std::string> hasher;
^
/usr/local/include/tesseract/helpers.h:50:28: error: ‘hasher’ was not declared in this scope
std::hash<std::string> hasher;
^
tesserocr.cpp: In function ‘tesseract::TessResultRenderer* __pyx_f_9tesserocr_13PyTessBaseAPI__get_renderer(__pyx_obj_9tesserocr_PyTessBaseAPI*, __pyx_t_9tesseract_cchar_t*)’:
tesserocr.cpp:16699:106: error: no matching function for call to ‘tesseract::TessPDFRenderer::TessPDFRenderer(__pyx_t_9tesseract_cchar_t*&, const char*)’
__pyx_t_7 = new tesseract::TessPDFRenderer(__pyx_v_outputbase, __pyx_v_self->_baseapi.GetDatapath());
^
tesserocr.cpp:16699:106: note: candidates are:
In file included from tesserocr.cpp:459:0:
/usr/local/include/tesseract/renderer.h:190:3: note: tesseract::TessPDFRenderer::TessPDFRenderer(const char*, const char*, bool)
TessPDFRenderer(const char* outputbase, const char* datadir, bool textonly);
^
/usr/local/include/tesseract/renderer.h:190:3: note: candidate expects 3 arguments, 2 provided
/usr/local/include/tesseract/renderer.h:186:16: note: tesseract::TessPDFRenderer::TessPDFRenderer(const tesseract::TessPDFRenderer&)
class TESS_API TessPDFRenderer : public TessResultRenderer {
^
/usr/local/include/tesseract/renderer.h:186:16: note: candidate expects 1 argument, 2 provided
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
我在底部收到此错误
----------------------------------------
Command "/home/ajay/virtualenvs/v2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-L3JmI9/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 /tmp/pip-6eGBXb-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/ajay/virtualenvs/v2/include/site/python2.7/tesserocr" failed with error code 1 in /tmp/pip-build-L3JmI9/tesserocr/