gpt4 book ai didi

python - pip install tesserocr 失败,出现错误 "Failed building wheel for tesserocr"

转载 作者:太空狗 更新时间:2023-10-30 01:32:18 26 4
gpt4 key购买 nike

I already have the latest builds for leptonica and 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

This the error i'm getting when i do pip install tesserocr in my virtualenv

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

I get this error at the bottom

        ----------------------------------------
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/

最佳答案

问题终于解决了

从系统中完全删除 tesseract 和 leptonica 并从源代码构建所有内容

问题出在 ubuntu 14.04 的 debian 包 leptonica-dev

这些是我编译的当前版本

$ tesseract -v
tesseract 3.04.01
leptonica-1.74.1
libjpeg 8d (libjpeg-turbo 1.3.0) : libpng 1.2.50 : libtiff 4.0.3 : zlib 1.2.8

关于python - pip install tesserocr 失败,出现错误 "Failed building wheel for tesserocr",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43316274/

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