简体   繁体   English

ImportError:ubuntu 中没有名为 pytesseract 的模块

[英]ImportError: No module named pytesseract in ubuntu

i have installed two libraries pillow & pytesseract by pip3我已经通过pip3安装了两个库pillowpytesseract

in order to do ocr为了做ocr
when i run this code当我运行这段代码时

import Image
from pytesseract import image_to_string

img = Image.open('mz.png')

print(image_to_string(img))

i am getting ImportError: No module named pytesseract error when i again install pytesseract it says requirement satisfied当我再次安装pytesseract时出现ImportError: No module named pytesseract错误,它说requirement satisfied

whats wrong with this这有什么问题

您可能已安装了多个Python版本,并尝试与另一个文件一起运行文件,因为您已将软件包安装到其中

try and install tesseract ocr with sudo apt-get install tesseract-ocr 尝试使用sudo apt-get install tesseract-ocr安装tesseract ocr sudo apt-get install tesseract-ocr

and then use sudo pip3 install pytesseract 然后使用sudo pip3 install pytesseract

these 2 lines should fix your problem. 这2行应该可以解决您的问题。

Try to run following 3 commands first in sequential manner尝试以顺序方式首先运行以下 3 个命令

  1. sudo apt-get update sudo apt-get 更新
  2. sudo apt-get install tesseract-ocr sudo apt-get install tesseract-ocr
  3. sudo apt-get install libtesseract-dev sudo apt-get install libtesseract-dev

and then install pytesseract using然后使用安装 pytesseract

  • pip install pytesseract pip 安装pytesseract

This should fix your problem.这应该可以解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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