gpt4 book ai didi

python 进口: ModuleNotFoundError: No module named 'pytesser'

转载 作者:太空宇宙 更新时间:2023-11-04 02:37:14 25 4
gpt4 key购买 nike

大家好,我是 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'

我相信因为 python 的 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.

请问有什么办法可以解决吗?需要一些帮助。

最佳答案

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

打开 anaconda 命令行提示符并使用 pip 安装你的包

pip install pytesseract

关于 python 进口: ModuleNotFoundError: No module named 'pytesser' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47605345/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com