BackupGGCode / python-tesseract

python wrapper class for tesseract OCR (Linux & Mac & Windows)
3 stars 1 forks source link

AttributeError:'module' object has no attribute 'TessBaseAPI' Ask #72

Open jenish08 opened 7 years ago

jenish08 commented 7 years ago

import tesseract api = tesseract.TessBaseAPI() api.Init(".","eng",tesseract.OEM_DEFAULT)

I have an error: AttributeError:'module' object has no attribute 'TessBaseAPI'

krovein commented 5 years ago

Hello. Do you resolve that issue? i have a proplem like that, but i don't know how can i resolve that. Please help me!

RicoLiu commented 5 years ago

run:

pip install tesserocr

then:

import tesserocr
api = tesserocr.PytessBaseAPI()
threenotcompany commented 5 years ago

$ pip install tesserocr Collecting tesserocr Using cached https://files.pythonhosted.org/packages/92/2d/05a7f8387e93c192919b508e4f4936f232bd3d2ca388b9130ae538a9f9ad/tesserocr-2.4.0.tar.gz Building wheels for collected packages: tesserocr Building wheel for tesserocr (setup.py) ... error Complete output from command /home/kuldeep/envpy3/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-install-89e0cxg0/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/pip-wheel-g5i02r7u --python-tag cp36: Supporting tesseract v4.1.0-rc1-125-gac7e Configs from pkg-config: {'include_dirs': ['/usr/include'], 'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': {'TESSERACT_VERSION': 67174400}} 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 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include -I/usr/include/python3.6m -I/home/kuldeep/envpy3/include/python3.6m -c tesserocr.cpp -o build/temp.linux-x86_64-3.6/tesserocr.o -std=c++11 -DUSE_STD_NAMESPACE tesserocr.cpp:42:20: fatal error: Python.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/kuldeep/envpy3/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-install-89e0cxg0/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-record-7ris2ukh/install-record.txt --single-version-externally-managed --compile --install-headers /home/kuldeep/envpy3/include/site/python3.6/tesserocr: Supporting tesseract v4.1.0-rc1-125-gac7e Configs from pkg-config: {'include_dirs': ['/usr/include'], 'libraries': ['lept', 'tesseract'], 'cython_compile_time_env': {'TESSERACT_VERSION': 67174400}} 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 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include -I/usr/include/python3.6m -I/home/kuldeep/envpy3/include/python3.6m -c tesserocr.cpp -o build/temp.linux-x86_64-3.6/tesserocr.o -std=c++11 -DUSE_STD_NAMESPACE tesserocr.cpp:42:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------

Command "/home/kuldeep/envpy3/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-install-89e0cxg0/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-record-7ris2ukh/install-record.txt --single-version-externally-managed --compile --install-headers /home/kuldeep/envpy3/include/site/python3.6/tesserocr" failed with error code 1 in /tmp/pip-install-89e0cxg0/tesserocr/

whats wrong here?