python error2_Python - Tesseract-WindowsError: [Error 2] ?

后凯捷
2023-12-01

用python识别验证码,安装了PIL,pytesseract,也安装了Tesseract,但是无法运行

也设置了环境变量

#coding=utf-8

import pytesseract

import PIL

# import os

# os.chdir('C:\\Python27\\Lib\\site-packages\pytesseract')

image = PIL.Image.open('E:\\0.png')

vcode = pytesseract.image_to_string(image)

print vcode

错误提示:

C:\Python27\python.exe E:/学习/Python/test/test.py

Traceback (most recent call last):

File "E:/ѧϰ/Python/test/test.py", line 7, in

vcode = pytesseract.image_to_string(image)

File "C:\Python27\lib\site-packages\pytesseract\pytesseract.py", line 162, in image_to_string

config=config)

File "C:\Python27\lib\site-packages\pytesseract\pytesseract.py", line 95, in run_tesseract

stderr=subprocess.PIPE)

File "C:\Python27\lib\subprocess.py", line 710, in init

errread, errwrite)

File "C:\Python27\lib\subprocess.py", line 958, in _execute_child

startupinfo)

WindowsError: [Error 2]

Process finished with exit code 1

 类似资料: