没有名为pytesseract的模块错误

时间:2017-11-19 10:44:29

标签: python tesseract python-tesseract

我正在尝试使用pytesseract进行OCR,使用Raspbian

覆盆子pi

我已经阅读了关于这个主题的几个问题,但找不到有效的答案,他们通常会说用pip安装pytesseract,我就做了。

我的代码非常简单:

import pytesseract
from PIL import Image
print(pytesseract.image_to_string(Image.open('test.jpg')))

但它返回错误消息:“ImportError:没有名为'pytesseract'的模块

我已经安装了tesseracrt-ocr( whereis tesseract-ocr 命令返回 / usr / share / tesseract-ocr

我已经用 pip install tesseract 安装了pytesseract(它返回成功安装了Pillow-4.3.0 olefile-0.44 pytesseract-0.1.7 ...但 whereis pytesseract 命令不返回任何内容 - >问题?)。

你知道我有什么问题吗?

2 个答案:

答案 0 :(得分:2)

使用

安装pytesseract后查看
<cmd>C:\> pip install pytesseract

尝试:

  
    
      

import pytesseract

    
  

如果上面没有工作,那么它已经对安装做了一些事情, 检查“\ Python27 \ Lib \ site-packages”下的pytesseract文件夹是否可用,

从网站包尝试上面的命令,希望这有帮助, 否则安装有问题。

答案 1 :(得分:0)

在代码中添加此行

[[1, 2], [3, 4], [5, 6], [7, 8]]

设置安装tesseract-ocr的路径,并将此路径添加到窗口环境变量。还要检查此链接Tesseract installation,以完整安装tesseract。