尝试安装 tesserocr 时出错

Posted

技术标签:

【中文标题】尝试安装 tesserocr 时出错【英文标题】:error while trying to install tesserocr 【发布时间】:2017-09-15 03:30:51 【问题描述】:

我在尝试安装时总是遇到同样的错误

(env) vagrant@vagrant:~$ 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/vagrant/src/env/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-4K2D6A/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/tmp5p5G1lpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_ext
  Failed to extract tesseract version from executable: [Errno 2] No such file or directory
  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
  creating build
  creating build/temp.linux-x86_64-2.7
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -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++
  tesserocr.cpp:446:34: fatal error: leptonica/allheaders.h: No such file or directory
  compilation terminated.
  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/vagrant/src/env/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-4K2D6A/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-mePzAW-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/vagrant/src/env/include/site/python2.7/tesserocr:
    running install
    running build
    running build_ext
    Failed to extract tesseract version from executable: [Errno 2] No such file or directory
    Supporting tesseract v3.04.00
    Building with configs: 'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': 'TESSERACT_VERSION': 197632
    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 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -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++
    tesserocr.cpp:446:34: fatal error: leptonica/allheaders.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/home/vagrant/src/env/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-4K2D6A/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-mePzAW-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/vagrant/src/env/include/site/python2.7/tesserocr" failed with error code 1 in /tmp/pip-build-4K2D6A/tesserocr/

萨钦系统错误:

pip install tesserocr                                                                                     
Collecting tesserocr
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  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 /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-YcBV5a/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/tmpRrPD1Vpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_ext
  pkg-config failed to find tesseract/lep libraries: Package tesseract was not found in the pkg-config search path.
  Perhaps you should add the directory containing `tesseract.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'tesseract' found

  Supporting tesseract v3.03
  Building with configs: 'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': 'TESSERACT_VERSION': 771
  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 -fPIC -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]
  tesserocr.cpp: In function ‘PyObject* __pyx_pf_9tesserocr_14PyPageIterator_20SetBoundingBoxComponents(__pyx_obj_9tesserocr_PyPageIterator*, bool, bool)’:
  tesserocr.cpp:4622:25: error: ‘class tesseract::PageIterator’ has no member named ‘SetBoundingBoxComponents’
     __pyx_v_self->_piter->SetBoundingBoxComponents(__pyx_v_include_upper_dots, __pyx_v_include_lower_dots);
                           ^
  tesserocr.cpp: In function ‘PyObject* __pyx_pf_9tesserocr_14PyPageIterator_34GetImage(__pyx_obj_9tesserocr_PyPageIterator*, tesseract::PageIteratorLevel, int, PyObject*)’:
  tesserocr.cpp:5854:125: error: no matching function for call to ‘tesseract::PageIterator::GetImage(tesseract::PageIteratorLevel&, int&, Pix*&, int*, int*)’
     __pyx_v_pix = __pyx_v_self->_piter->GetImage(__pyx_v_level, __pyx_v_padding, __pyx_v_opix, (&__pyx_v_left), (&__pyx_v_top));
                                                                                                                               ^
  tesserocr.cpp:5854:125: note: candidate is:
  In file included from tesserocr.cpp:456:0:
  /usr/include/tesseract/pageiterator.h:239:8: note: Pix* tesseract::PageIterator::GetImage(tesseract::PageIteratorLevel, int, int*, int*) const
     Pix* GetImage(PageIteratorLevel level, int padding,
          ^
  /usr/include/tesseract/pageiterator.h:239:8: note:   candidate expects 4 arguments, 5 provided
  tesserocr.cpp: In function ‘PyObject* __pyx_pf_9tesserocr_13PyTessBaseAPI_74AnalyseLayout(__pyx_obj_9tesserocr_PyTessBaseAPI*, bool)’:
  tesserocr.cpp:16256:83: error: no matching function for call to ‘tesseract::TessBaseAPI::AnalyseLayout(bool&)’
     __pyx_v_piter = __pyx_v_self->_baseapi.AnalyseLayout(__pyx_v_merge_similar_words);
                                                                                     ^
  tesserocr.cpp:16256:83: note: candidate is:
  In file included from tesserocr.cpp:461:0:
  /usr/include/tesseract/baseapi.h:489:17: note: tesseract::PageIterator* tesseract::TessBaseAPI::AnalyseLayout()
     PageIterator* AnalyseLayout();
                   ^
  /usr/include/tesseract/baseapi.h:489:17: note:   candidate expects 0 arguments, 1 provided
  tesserocr.cpp: In function ‘tesseract::TessResultRenderer* __pyx_f_9tesserocr_13PyTessBaseAPI__get_renderer(__pyx_obj_9tesserocr_PyTessBaseAPI*, __pyx_t_9tesseract_cchar_t*)’:
  tesserocr.cpp:16600:88: error: no matching function for call to ‘tesseract::TessHOcrRenderer::TessHOcrRenderer(__pyx_t_9tesseract_cchar_t*&, bool&)’
         __pyx_t_2 = new tesseract::TessHOcrRenderer(__pyx_v_outputbase, __pyx_v_font_info);
                                                                                          ^
  tesserocr.cpp:16600:88: note: candidates are:
  In file included from tesserocr.cpp:459:0:
  /usr/include/tesseract/renderer.h:175:3: note: tesseract::TessHOcrRenderer::TessHOcrRenderer()
     TessHOcrRenderer();
     ^
  /usr/include/tesseract/renderer.h:175:3: note:   candidate expects 0 arguments, 2 provided
  /usr/include/tesseract/renderer.h:173:16: note: tesseract::TessHOcrRenderer::TessHOcrRenderer(const tesseract::TessHOcrRenderer&)
   class TESS_API TessHOcrRenderer : public TessResultRenderer 
                  ^
  /usr/include/tesseract/renderer.h:173:16: note:   candidate expects 1 argument, 2 provided
  tesserocr.cpp:16643:106: error: no matching function for call to ‘tesseract::TessPDFRenderer::TessPDFRenderer(__pyx_t_9tesseract_cchar_t*&, const char*)’
         __pyx_t_3 = new tesseract::TessPDFRenderer(__pyx_v_outputbase, __pyx_v_self->_baseapi.GetDatapath());
                                                                                                            ^
  tesserocr.cpp:16643:106: note: candidates are:
  In file included from tesserocr.cpp:459:0:
  /usr/include/tesseract/renderer.h:188:3: note: tesseract::TessPDFRenderer::TessPDFRenderer(const char*)
     TessPDFRenderer(const char *datadir);
     ^
  /usr/include/tesseract/renderer.h:188:3: note:   candidate expects 1 argument, 2 provided
  /usr/include/tesseract/renderer.h:186:16: note: tesseract::TessPDFRenderer::TessPDFRenderer(const tesseract::TessPDFRenderer&)
   class TESS_API TessPDFRenderer : public TessResultRenderer 
                  ^
  /usr/include/tesseract/renderer.h:186:16: note:   candidate expects 1 argument, 2 provided
  tesserocr.cpp:16727:69: error: no matching function for call to ‘tesseract::TessUnlvRenderer::TessUnlvRenderer(__pyx_t_9tesseract_cchar_t*&)’
         __pyx_t_4 = new tesseract::TessUnlvRenderer(__pyx_v_outputbase);
                                                                       ^
  tesserocr.cpp:16727:69: note: candidates are:
  In file included from tesserocr.cpp:459:0:
  /usr/include/tesseract/renderer.h:227:3: note: tesseract::TessUnlvRenderer::TessUnlvRenderer()
     TessUnlvRenderer();
     ^
  /usr/include/tesseract/renderer.h:227:3: note:   candidate expects 0 arguments, 1 provided
  /usr/include/tesseract/renderer.h:225:16: note: tesseract::TessUnlvRenderer::TessUnlvRenderer(const tesseract::TessUnlvRenderer&)
   class TESS_API TessUnlvRenderer : public TessResultRenderer 
                  ^
  /usr/include/tesseract/renderer.h:225:16: note:   no known conversion for argument 1 from ‘__pyx_t_9tesseract_cchar_t* aka const char*’ to ‘const tesseract::TessUnlvRenderer&’
  tesserocr.cpp:16811:72: error: no matching function for call to ‘tesseract::TessBoxTextRenderer::TessBoxTextRenderer(__pyx_t_9tesseract_cchar_t*&)’
         __pyx_t_5 = new tesseract::TessBoxTextRenderer(__pyx_v_outputbase);
                                                                          ^
  tesserocr.cpp:16811:72: note: candidates are:
  In file included from tesserocr.cpp:459:0:
  /usr/include/tesseract/renderer.h:238:3: note: tesseract::TessBoxTextRenderer::TessBoxTextRenderer()
     TessBoxTextRenderer();
     ^
  /usr/include/tesseract/renderer.h:238:3: note:   candidate expects 0 arguments, 1 provided
  /usr/include/tesseract/renderer.h:236:16: note: tesseract::TessBoxTextRenderer::TessBoxTextRenderer(const tesseract::TessBoxTextRenderer&)
   class TESS_API TessBoxTextRenderer : public TessResultRenderer 
                  ^
  /usr/include/tesseract/renderer.h:236:16: note:   no known conversion for argument 1 from ‘__pyx_t_9tesseract_cchar_t* aka const char*’ to ‘const tesseract::TessBoxTextRenderer&’
  tesserocr.cpp:16895:69: error: no matching function for call to ‘tesseract::TessTextRenderer::TessTextRenderer(__pyx_t_9tesseract_cchar_t*&)’
         __pyx_t_6 = new tesseract::TessTextRenderer(__pyx_v_outputbase);
                                                                       ^
  tesserocr.cpp:16895:69: note: candidates are:
  In file included from tesserocr.cpp:459:0:
  /usr/include/tesseract/renderer.h:164:3: note: tesseract::TessTextRenderer::TessTextRenderer()
     TessTextRenderer();
     ^
  /usr/include/tesseract/renderer.h:164:3: note:   candidate expects 0 arguments, 1 provided
  /usr/include/tesseract/renderer.h:162:16: note: tesseract::TessTextRenderer::TessTextRenderer(const tesseract::TessTextRenderer&)
   class TESS_API TessTextRenderer : public TessResultRenderer 
                  ^
  /usr/include/tesseract/renderer.h:162:16: note:   no known conversion for argument 1 from ‘__pyx_t_9tesseract_cchar_t* aka const char*’ to ‘const tesseract::TessTextRenderer&’
  tesserocr.cpp: In function ‘PyObject* __pyx_pf_9tesserocr_13PyTessBaseAPI_108IsValidCharacter(__pyx_obj_9tesserocr_PyTessBaseAPI*, PyObject*)’:
  tesserocr.cpp:19661:60: error: ‘class tesseract::TessBaseAPI’ has no member named ‘IsValidCharacter’
     __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_baseapi.IsValidCharacter(__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2161, __pyx_L1_error)
                                                              ^
  tesserocr.cpp:544:36: note: in definition of macro ‘__Pyx_PyBool_FromLong’
   #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
                                      ^
  tesserocr.cpp: In function ‘void inittesserocr()’:
  tesserocr.cpp:25014:67: error: ‘PSM_RAW_LINE’ is not a member of ‘tesseract’
     __pyx_t_2 = __Pyx_PyInt_From_enum__tesseract_3a__3a_PageSegMode(tesseract::PSM_RAW_LINE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error)
                                                                     ^
  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 /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-YcBV5a/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-KHSvyq-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    pkg-config failed to find tesseract/lep libraries: Package tesseract was not found in the pkg-config search path.
    Perhaps you should add the directory containing `tesseract.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'tesseract' found

    Supporting tesseract v3.03
    Building with configs: 'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': 'TESSERACT_VERSION': 771
    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 -fPIC -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]
    tesserocr.cpp: In function ‘PyObject* __pyx_pf_9tesserocr_14PyPageIterator_20SetBoundingBoxComponents(__pyx_obj_9tesserocr_PyPageIterator*, bool, bool)’:
    tesserocr.cpp:4622:25: error: ‘class tesseract::PageIterator’ has no member named ‘SetBoundingBoxComponents’
       __pyx_v_self->_piter->SetBoundingBoxComponents(__pyx_v_include_upper_dots, __pyx_v_include_lower_dots);
                             ^
    tesserocr.cpp: In function ‘PyObject* __pyx_pf_9tesserocr_14PyPageIterator_34GetImage(__pyx_obj_9tesserocr_PyPageIterator*, tesseract::PageIteratorLevel, int, PyObject*)’:
    tesserocr.cpp:5854:125: error: no matching function for call to ‘tesseract::PageIterator::GetImage(tesseract::PageIteratorLevel&, int&, Pix*&, int*, int*)’
       __pyx_v_pix = __pyx_v_self->_piter->GetImage(__pyx_v_level, __pyx_v_padding, __pyx_v_opix, (&__pyx_v_left), (&__pyx_v_top));
                                                                                                                                 ^
    tesserocr.cpp:5854:125: note: candidate is:
    In file included from tesserocr.cpp:456:0:
    /usr/include/tesseract/pageiterator.h:239:8: note: Pix* tesseract::PageIterator::GetImage(tesseract::PageIteratorLevel, int, int*, int*) const
       Pix* GetImage(PageIteratorLevel level, int padding,
            ^
    /usr/include/tesseract/pageiterator.h:239:8: note:   candidate expects 4 arguments, 5 provided
    tesserocr.cpp: In function ‘PyObject* __pyx_pf_9tesserocr_13PyTessBaseAPI_74AnalyseLayout(__pyx_obj_9tesserocr_PyTessBaseAPI*, bool)’:
    tesserocr.cpp:16256:83: error: no matching function for call to ‘tesseract::TessBaseAPI::AnalyseLayout(bool&)’
       __pyx_v_piter = __pyx_v_self->_baseapi.AnalyseLayout(__pyx_v_merge_similar_words);
                                                                                       ^
    tesserocr.cpp:16256:83: note: candidate is:
    In file included from tesserocr.cpp:461:0:
    /usr/include/tesseract/baseapi.h:489:17: note: tesseract::PageIterator* tesseract::TessBaseAPI::AnalyseLayout()
       PageIterator* AnalyseLayout();
                     ^
    /usr/include/tesseract/baseapi.h:489:17: note:   candidate expects 0 arguments, 1 provided
    tesserocr.cpp: In function ‘tesseract::TessResultRenderer* __pyx_f_9tesserocr_13PyTessBaseAPI__get_renderer(__pyx_obj_9tesserocr_PyTessBaseAPI*, __pyx_t_9tesseract_cchar_t*)’:
    tesserocr.cpp:16600:88: error: no matching function for call to ‘tesseract::TessHOcrRenderer::TessHOcrRenderer(__pyx_t_9tesseract_cchar_t*&, bool&)’
           __pyx_t_2 = new tesseract::TessHOcrRenderer(__pyx_v_outputbase, __pyx_v_font_info);
                                                                                            ^
    tesserocr.cpp:16600:88: note: candidates are:
    In file included from tesserocr.cpp:459:0:
    /usr/include/tesseract/renderer.h:175:3: note: tesseract::TessHOcrRenderer::TessHOcrRenderer()
       TessHOcrRenderer();
       ^
    /usr/include/tesseract/renderer.h:175:3: note:   candidate expects 0 arguments, 2 provided
    /usr/include/tesseract/renderer.h:173:16: note: tesseract::TessHOcrRenderer::TessHOcrRenderer(const tesseract::TessHOcrRenderer&)
     class TESS_API TessHOcrRenderer : public TessResultRenderer 
                    ^
    /usr/include/tesseract/renderer.h:173:16: note:   candidate expects 1 argument, 2 provided
    tesserocr.cpp:16643:106: error: no matching function for call to ‘tesseract::TessPDFRenderer::TessPDFRenderer(__pyx_t_9tesseract_cchar_t*&, const char*)’
           __pyx_t_3 = new tesseract::TessPDFRenderer(__pyx_v_outputbase, __pyx_v_self->_baseapi.GetDatapath());
                                                                                                              ^
    tesserocr.cpp:16643:106: note: candidates are:
    In file included from tesserocr.cpp:459:0:
    /usr/include/tesseract/renderer.h:188:3: note: tesseract::TessPDFRenderer::TessPDFRenderer(const char*)
       TessPDFRenderer(const char *datadir);
       ^
    /usr/include/tesseract/renderer.h:188:3: note:   candidate expects 1 argument, 2 provided
    /usr/include/tesseract/renderer.h:186:16: note: tesseract::TessPDFRenderer::TessPDFRenderer(const tesseract::TessPDFRenderer&)
     class TESS_API TessPDFRenderer : public TessResultRenderer 
                    ^
    /usr/include/tesseract/renderer.h:186:16: note:   candidate expects 1 argument, 2 provided
    tesserocr.cpp:16727:69: error: no matching function for call to ‘tesseract::TessUnlvRenderer::TessUnlvRenderer(__pyx_t_9tesseract_cchar_t*&)’
           __pyx_t_4 = new tesseract::TessUnlvRenderer(__pyx_v_outputbase);
                                                                         ^
    tesserocr.cpp:16727:69: note: candidates are:
    In file included from tesserocr.cpp:459:0:
    /usr/include/tesseract/renderer.h:227:3: note: tesseract::TessUnlvRenderer::TessUnlvRenderer()
       TessUnlvRenderer();
       ^
    /usr/include/tesseract/renderer.h:227:3: note:   candidate expects 0 arguments, 1 provided
    /usr/include/tesseract/renderer.h:225:16: note: tesseract::TessUnlvRenderer::TessUnlvRenderer(const tesseract::TessUnlvRenderer&)
     class TESS_API TessUnlvRenderer : public TessResultRenderer 
                    ^
    /usr/include/tesseract/renderer.h:225:16: note:   no known conversion for argument 1 from ‘__pyx_t_9tesseract_cchar_t* aka const char*’ to ‘const tesseract::TessUnlvRenderer&’
    tesserocr.cpp:16811:72: error: no matching function for call to ‘tesseract::TessBoxTextRenderer::TessBoxTextRenderer(__pyx_t_9tesseract_cchar_t*&)’
           __pyx_t_5 = new tesseract::TessBoxTextRenderer(__pyx_v_outputbase);
                                                                            ^
    tesserocr.cpp:16811:72: note: candidates are:
    In file included from tesserocr.cpp:459:0:
    /usr/include/tesseract/renderer.h:238:3: note: tesseract::TessBoxTextRenderer::TessBoxTextRenderer()
       TessBoxTextRenderer();
       ^
    /usr/include/tesseract/renderer.h:238:3: note:   candidate expects 0 arguments, 1 provided
    /usr/include/tesseract/renderer.h:236:16: note: tesseract::TessBoxTextRenderer::TessBoxTextRenderer(const tesseract::TessBoxTextRenderer&)
     class TESS_API TessBoxTextRenderer : public TessResultRenderer 
                    ^
    /usr/include/tesseract/renderer.h:236:16: note:   no known conversion for argument 1 from ‘__pyx_t_9tesseract_cchar_t* aka const char*’ to ‘const tesseract::TessBoxTextRenderer&’
    tesserocr.cpp:16895:69: error: no matching function for call to ‘tesseract::TessTextRenderer::TessTextRenderer(__pyx_t_9tesseract_cchar_t*&)’
           __pyx_t_6 = new tesseract::TessTextRenderer(__pyx_v_outputbase);
                                                                         ^
    tesserocr.cpp:16895:69: note: candidates are:
    In file included from tesserocr.cpp:459:0:
    /usr/include/tesseract/renderer.h:164:3: note: tesseract::TessTextRenderer::TessTextRenderer()
       TessTextRenderer();
       ^
    /usr/include/tesseract/renderer.h:164:3: note:   candidate expects 0 arguments, 1 provided
    /usr/include/tesseract/renderer.h:162:16: note: tesseract::TessTextRenderer::TessTextRenderer(const tesseract::TessTextRenderer&)
     class TESS_API TessTextRenderer : public TessResultRenderer 
                    ^
    /usr/include/tesseract/renderer.h:162:16: note:   no known conversion for argument 1 from ‘__pyx_t_9tesseract_cchar_t* aka const char*’ to ‘const tesseract::TessTextRenderer&’
    tesserocr.cpp: In function ‘PyObject* __pyx_pf_9tesserocr_13PyTessBaseAPI_108IsValidCharacter(__pyx_obj_9tesserocr_PyTessBaseAPI*, PyObject*)’:
    tesserocr.cpp:19661:60: error: ‘class tesseract::TessBaseAPI’ has no member named ‘IsValidCharacter’
       __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_baseapi.IsValidCharacter(__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2161, __pyx_L1_error)
                                                                ^
    tesserocr.cpp:544:36: note: in definition of macro ‘__Pyx_PyBool_FromLong’
     #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
                                        ^
    tesserocr.cpp: In function ‘void inittesserocr()’:
    tesserocr.cpp:25014:67: error: ‘PSM_RAW_LINE’ is not a member of ‘tesseract’
       __pyx_t_2 = __Pyx_PyInt_From_enum__tesseract_3a__3a_PageSegMode(tesseract::PSM_RAW_LINE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error)
                                                                       ^
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-YcBV5a/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-KHSvyq-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-YcBV5a/tesserocr/

【问题讨论】:

【参考方案1】:

今天遇到了这个问题。发生这种情况是因为我们缺少这些库

libleptonica-dev 和 libtesseract-dev

解决方案是使用包管理器安装它们。

Ubuntu apt-get install libleptonica-dev libtesseract-dev Mac pip install tesserocr 将自动安装tesserocr 及其依赖库leptonica

解决了问题

【讨论】:

按照我的建议,您遇到了什么问题/错误,您的平台是什么? 我在 cloud9 上使用 ubuntu。请参阅上面的更新错误。 尝试安装 python-dev 包,也许你缺少标题 如果安装上述库没有帮助,请同时安装 pkg-config - 它对我有用。 这对我也有帮助,谢谢!【参考方案2】:

我的错误是这样的:

Failed building wheel for tesserocr
(...)
Supporting tesseract v4.0.0
Building with configs: 'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': 'TESSERACT_VERSION': 67108864
(...)
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c tesserocr.cpp -o build/temp.linux-x86_64-3.6/tesserocr.o -std=c++11 -DUSE_STD_NAMESPACE
tesserocr.cpp: In function 'PyObject* __pyx_pf_9tesserocr_16PyResultIterator_8GetBestLSTMSymbolChoices(__pyx_obj_9tesserocr_PyResultIterator*)':
tesserocr.cpp:12192:43: error: 'class tesseract::ResultIterator' has no member named 'GetBestLSTMSymbolChoices'

   __pyx_v_output = (__pyx_v_self->_riter->GetBestLSTMSymbolChoices()[0]);
                                           ^~~~~~~~~~~~~~~~~~~~~~~~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-s6f5ze1q/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-lopr6cjz-record/install-record.txt --single-version-externally-managed --compile"

failed with error code 1 in /tmp/pip-build-s6f5ze1q/tesserocr/

我通过额外安装 pkg-config 库解决了这个问题。

apt-get install libleptonica-dev libtesseract-dev \
    tesseract-ocr tesseract-ocr-eng \
    pkg-config

【讨论】:

【参考方案3】:

如果您使用的是 linux(基于 Debian,例如 Ubuntu 14.04)系统,您想升级您的 Tesseract 版本。显然,在 Ubuntu 14.04 中,默认 Tesseract 版本是 3.03,tesserocr 不支持该版本。您必须使用一些较新的 Tesseract 版本(如 4.00 或 3.05)从源代码构建。但在较新的操作系统版本中,这应该不是问题。

点击安装链接即可Installing Tesserocr with Tesseract 3.04+

【讨论】:

以上是关于尝试安装 tesserocr 时出错的主要内容,如果未能解决你的问题,请参考以下文章

安装tesserocr的步骤和报错RuntimeError: Failed to init API, possibly an invalid tessdata path解决办法

尝试安装插件时出错

尝试安装 imblearn 包时出错

尝试在 openSUSE 上安装 pip 时出错

尝试安装 pm2 时出错

尝试安装猫鼬时出错