简体   繁体   English

不能运行pytesseract?

[英]Can't run pytesseract?

I'm trying to use pytesseract in a python script, but I keep getting the same error upon importing it. 我正在尝试在python脚本中使用pytesseract,但是在导入它时仍然出现相同的错误。 To check it was from pytesseract and not from something else, I typed pytesseract directly into my command line, and got this error: 为了检查它是来自pytesseract而不是其他东西,我直接在命令行中输入pytesseract ,并得到以下错误:

Traceback (most recent call last):
File "/usr/local/bin/pytesseract", line 7, in <module>
from pytesseract.pytesseract import main
File "/Library/Python/2.7/site-packages/pytesseract/__init__.py", line 
1, in <module>
from .pytesseract import (
File "/Library/Python/2.7/site-packages/pytesseract/pytesseract.py", line 9, in <module>
import Image
File "/Library/Python/2.7/site-packages/PIL/Image.py", line 27, in <module>
from . import VERSION, PILLOW_VERSION, _plugins
ValueError: Attempted relative import in non-package

But I know it's installed correctly, because when I try pip install pytesseract --user , I get back: 但是我知道它安装正确,因为当我尝试pip install pytesseract --user ,我得到了:

Requirement already satisfied: pytesseract in /Library/Python/2.7/site-packages
Requirement already satisfied: Pillow in /Library/Python/2.7/site-packages (from pytesseract)

I also already have tesseract installed, which I know because typing tesseract into my command line gives me all its information. 我还已经安装了tesseract,我知道这是因为在命令行中键入tesseract会给我所有信息。 Does anyone know what's wrong? 有人知道怎么了吗?

  1. Try to install dependency packages of tesseract and import Image and Pillow packages 尝试安装tesseract的依赖软件包并导入Image和Pillow软件包
  2. Or instead of pip install pytesseract, Download pytesseract package from online https://pypi.org/project/pytesseract/ and install it 或者不是从pip安装pytesseract,而是从在线https://pypi.org/project/pytesseract/下载pytesseract软件包并进行安装

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

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