简体   繁体   中英

Tesseract is not installed or it's not in your PATH

I'm currently on a ubuntu-environment and facing a problem when using tesseract and pycharm.

So i get the error mentioned in the Title when i try to run following code in pycharm:

import cv2
import opencv
import pytesseract

image = cv2.imread('assets/alugas/alugas.jpeg')
img_rgb = cv2.cvtColor(image,cv2.COLOR_BGR2RGB)
print(pytesseract.image_to_string(img_rgb,lang='eng'))

cv2.waitKey(0)

tesseract -v gives me:

tesseract -v
tesseract 4.1.1
 leptonica-1.79.0
  libgif 5.1.9 : libjpeg 8d (libjpeg-turbo 2.0.6) : libpng 1.6.37 : libtiff 4.3.0 : zlib 1.2.11 : libwebp 0.6.1 : libopenjp2 2.3.1
 Found AVX2
 Found AVX
 Found FMA
 Found SSE
 Found libarchive 3.4.3 zlib/1.2.11 liblzma/5.2.4 bz2lib/1.0.8 liblz4/1.9.2 libzstd/1.4.5

I've searched around and tried to use something like this on top of my code with different paths; pytesseract.pytesseract.tesseract_cmd = r'/usr/share/tesseract-ocr/'

EDIT: i have also tried everything here on SO, but most of the solutions given only works on windows it seems..

I'm not sure if i handled it correctly. But i tried to install homebrew and install tesseract that way. after that everything worked. So i guess I'll use homebrew from now on.

Since you find tesseract file in /usr/bin, did you try adding this line?

pytesseract.pytesseract.tesseract_cmd = "/usr/bin/tesseract"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM