枕头(PIL)显示“FileNotFoundError”

2024-05-16 18:40:13 发布

您现在位置:Python中文网/ 问答频道 /正文

所以,我有这个验证码,我需要从中提取文本。在

我一直在使用Pillow来完成这项工作,我也尝试过许多其他直接从github下载的libs,但都没用。有了枕头,我得到了一个错误:

Traceback (most recent call last):
  File "F:/Competitions/Donations/Scrapping.py", line 111, in <module>
    Scrapping()
  File "F:/Competitions/Donations/Scrapping.py", line 57, in __init__
    myText = image_to_string(Image.open(filePath), config='-psm 10')
  File "C:\Users\User Name\AppData\Roaming\Python\Python35\site-packages\pytesseract\pytesseract.py", line     161, in image_to_string
config=config)
  File "C:\Users\User Name\AppData\Roaming\Python\Python35\site-packages\pytesseract\pytesseract.py", line 94, in run_tesseract
    stderr=subprocess.PIPE)
  File "C:\Pythons\Python3.5\lib\subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "C:\Pythons\Python3.5\lib\subprocess.py", line 1224, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

这是一个基于image_to_string方法的错误,我无法集中精力解决这个问题。对此有什么建议吗?在

这是我使用的代码:

^{pr2}$

filePath是图像的路径。在

说明:验证码图片:http://imgur.com/dRmna1z


Tags: toinpyimageconfigstring错误line
1条回答
网友
1楼 · 发布于 2024-05-16 18:40:13

似乎您没有安装tesseract,或者您的PATH上没有安装

the directions开始,您需要能够从命令行调用tesseract。在

您得到的实际错误与PILPillow无关(请注意,PIL文件都没有在stacktrace中列出)。在

实际的错误来自here子进程输出到tesseract

相关问题 更多 >