gpt4 book ai didi

python - pip3 install tesserocr 给出错误

转载 作者:行者123 更新时间:2023-12-01 09:27:18 31 4
gpt4 key购买 nike

我正在尝试在 Ubuntu 上安装 python3.6 的 tesserocr 包。当我运行pip3 install tesserocr时,我收到此错误:

Running setup.py bdist_wheel for tesserocr ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-cmhownuf/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/tmpg1f69eahpip-wheel- --python-tag cp36:
Supporting tesseract v4.0.0-beta.1
Configs from pkg-config: {'include_dirs': ['/usr/include'], 'libraries': ['lept', 'tesseract'], 'cython_compile_time_env': {'TESSERACT_VERSION': 1024}}
running bdist_wheel
running build
running build_ext
building 'tesserocr' extension
creating build
creating build/temp.linux-x86_64-3.6
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include -I/usr/include/python3.6m -c tesserocr.cpp -o build/temp.linux-x86_64-3.6/tesserocr.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
tesserocr.cpp: In function ‘tesseract::TessResultRenderer* __pyx_f_9tesserocr_13PyTessBaseAPI__get_renderer(__pyx_obj_9tesserocr_PyTessBaseAPI*, __pyx_t_9tesseract_cchar_t*)’:
tesserocr.cpp:21180: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());
^
In file included from tesserocr.cpp:625:0:
/usr/include/tesseract/renderer.h:190:3: note: candidate: tesseract::TessPDFRenderer::TessPDFRenderer(const char*, const char*, bool)
TessPDFRenderer(const char* outputbase, const char* datadir, bool textonly);
^~~~~~~~~~~~~~~
/usr/include/tesseract/renderer.h:190:3: note: candidate expects 3 arguments, 2 provided
/usr/include/tesseract/renderer.h:186:16: note: candidate: 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
/usr/include/tesseract/renderer.h:186:16: note: candidate: tesseract::TessPDFRenderer::TessPDFRenderer(tesseract::TessPDFRenderer&&)
/usr/include/tesseract/renderer.h:186:16: note: candidate expects 1 argument, 2 provided
tesserocr.cpp: In function ‘PyObject* PyInit_tesserocr()’:
tesserocr.cpp:34594:81: error: ‘OEM_CUBE_ONLY’ is not a member of ‘tesseract’
__pyx_t_10 = __Pyx_PyInt_From_enum__tesseract_3a__3a_OcrEngineMode(tesseract::OEM_CUBE_ONLY); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 84, __pyx_L1_error)
^~~~~~~~~~~~~
tesserocr.cpp:34594:81: note: suggested alternative: ‘OEM_LSTM_ONLY’
__pyx_t_10 = __Pyx_PyInt_From_enum__tesseract_3a__3a_OcrEngineMode(tesseract::OEM_CUBE_ONLY); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 84, __pyx_L1_error)
^~~~~~~~~~~~~
OEM_LSTM_ONLY
tesserocr.cpp:34607:81: error: ‘OEM_TESSERACT_CUBE_COMBINED’ is not a member of ‘tesseract’
__pyx_t_10 = __Pyx_PyInt_From_enum__tesseract_3a__3a_OcrEngineMode(tesseract::OEM_TESSERACT_CUBE_COMBINED); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 85, __pyx_L1_error)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
tesserocr.cpp:34607:81: note: suggested alternative: ‘OEM_TESSERACT_LSTM_COMBINED’
__pyx_t_10 = __Pyx_PyInt_From_enum__tesseract_3a__3a_OcrEngineMode(tesseract::OEM_TESSERACT_CUBE_COMBINED); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 85, __pyx_L1_error)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
OEM_TESSERACT_LSTM_COMBINED
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/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-cmhownuf/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-uewp6mk4-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
Supporting tesseract v4.0.0-beta.1
Configs from pkg-config: {'include_dirs': ['/usr/include'], 'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': {'TESSERACT_VERSION': 1024}}
running install
running build
running build_ext
building 'tesserocr' extension
creating build
creating build/temp.linux-x86_64-3.6
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include -I/usr/include/python3.6m -c tesserocr.cpp -o build/temp.linux-x86_64-3.6/tesserocr.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
tesserocr.cpp: In function ‘tesseract::TessResultRenderer* __pyx_f_9tesserocr_13PyTessBaseAPI__get_renderer(__pyx_obj_9tesserocr_PyTessBaseAPI*, __pyx_t_9tesseract_cchar_t*)’:
tesserocr.cpp:21180: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());
^
In file included from tesserocr.cpp:625:0:
/usr/include/tesseract/renderer.h:190:3: note: candidate: tesseract::TessPDFRenderer::TessPDFRenderer(const char*, const char*, bool)
TessPDFRenderer(const char* outputbase, const char* datadir, bool textonly);
^~~~~~~~~~~~~~~
/usr/include/tesseract/renderer.h:190:3: note: candidate expects 3 arguments, 2 provided
/usr/include/tesseract/renderer.h:186:16: note: candidate: 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
/usr/include/tesseract/renderer.h:186:16: note: candidate: tesseract::TessPDFRenderer::TessPDFRenderer(tesseract::TessPDFRenderer&&)
/usr/include/tesseract/renderer.h:186:16: note: candidate expects 1 argument, 2 provided
tesserocr.cpp: In function ‘PyObject* PyInit_tesserocr()’:
tesserocr.cpp:34594:81: error: ‘OEM_CUBE_ONLY’ is not a member of ‘tesseract’
__pyx_t_10 = __Pyx_PyInt_From_enum__tesseract_3a__3a_OcrEngineMode(tesseract::OEM_CUBE_ONLY); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 84, __pyx_L1_error)
^~~~~~~~~~~~~
tesserocr.cpp:34594:81: note: suggested alternative: ‘OEM_LSTM_ONLY’
__pyx_t_10 = __Pyx_PyInt_From_enum__tesseract_3a__3a_OcrEngineMode(tesseract::OEM_CUBE_ONLY); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 84, __pyx_L1_error)
^~~~~~~~~~~~~
OEM_LSTM_ONLY
tesserocr.cpp:34607:81: error: ‘OEM_TESSERACT_CUBE_COMBINED’ is not a member of ‘tesseract’
__pyx_t_10 = __Pyx_PyInt_From_enum__tesseract_3a__3a_OcrEngineMode(tesseract::OEM_TESSERACT_CUBE_COMBINED); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 85, __pyx_L1_error)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
tesserocr.cpp:34607:81: note: suggested alternative: ‘OEM_TESSERACT_LSTM_COMBINED’
__pyx_t_10 = __Pyx_PyInt_From_enum__tesseract_3a__3a_OcrEngineMode(tesseract::OEM_TESSERACT_CUBE_COMBINED); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 85, __pyx_L1_error)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
OEM_TESSERACT_LSTM_COMBINED
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-cmhownuf/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-uewp6mk4-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-cmhownuf/tesserocr/

最佳答案

谢谢大家,我已经解决了。我从 git 下载 tesserocr 源文件并运行:

henry@PC:~/tesserocr$ pip3 install .
Processing /home/henry/tesserocr
Installing collected packages: tesserocr
Running setup.py install for tesserocr ... done
Successfully installed tesserocr-2.2.2

花了很多时间,但终于成功了。看来tesserocr的pip源与最新的tesseract-ocr不匹配,需要手动安装。

关于python - pip3 install tesserocr 给出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50277848/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com