python import:ModuleNotFoundError:没有名为'pytesser'的模块

时间:2017-12-02 06:39:04

标签: python anaconda ocr pytesser

嗨,我是python和OCR的新手。我正在尝试实施OCR。我已经安装了OCR所需的所有依赖项。同样重要的是我使用的是Anaconda定制提供的Python。因此,当我尝试导入pytesser时,它会显示ModuleNotFoundError: No module named 'pytesser'。我正在尝试执行一个简单的以下程序:

import sys
print (sys.path)
from PIL import Image
from pytesser import *

image_file = 'imageSample1.jpg'
im = Image.open(image_file)
text = image_to_string(im)
text = image_file_to_string(image_file)
text = image_file_to_string(image_file, graceful_errors=True)
print ("=====output=======\n")
print (text)

得到以下输出:

nilkash@nilkash:~/ubuntuBackup/My_Folder/Its_my_work/DS/ML&AI/ImageRecognition$ python SampleImageContentRecognition.py 
['/home/nilkash/ubuntuBackup/My_Folder/Its_my_work/DS/ML&AI/ImageRecognition', '/home/nilkash/anaconda3/lib/python36.zip', '/home/nilkash/anaconda3/lib/python3.6', '/home/nilkash/anaconda3/lib/python3.6/lib-dynload', '/home/nilkash/anaconda3/lib/python3.6/site-packages', '/home/nilkash/anaconda3/lib/python3.6/site-packages/Sphinx-1.5.6-py3.6.egg', '/home/nilkash/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg']
Traceback (most recent call last):
  File "SampleImageContentRecognition.py", line 4, in <module>
    from pytesser import *
ModuleNotFoundError: No module named 'pytesser'

我相信因为pyda的conda发布它无法使用它。有没有办法链接它。或者我做错了什么。需要一些帮助。谢谢。

我深入研究了这个问题。我安装了两个python版本,一个是python2.7,另一个是python3.6。所以我的所有pytesseract配置都是python2.7。但我使用的是3.6版。所以我认为我需要做的是删除所有pytesseract并安装python3.6。或者将所有配置移动到指向python3.6。我尝试通过conda install -c auto pytesseract conda版本的pytesseract,但得到以下错误:

UnsatisfiableError: The following specifications were found to be in conflict:
  - pytesseract -> python 2.7*
  - python 3.6*
Use "conda info <package>" to see the dependencies for each package.

有什么方法可以解决这个问题。需要一些帮助。

2 个答案:

答案 0 :(得分:2)

你应该能够在你的anaconda提示中使用PIP Using Pip to install packages to Anaconda Environment

打开anaconda命令行提示符并使用pip

安装包

pip install pytesseract

答案 1 :(得分:0)

看起来它们不在同一路径下,而python无法找到它。

请参考此链接:

How to reset System Variable PATH after tesseract installation

相关问题