所以,我有这个验证码,我需要从中提取文本。枕头(PIL)显示“FileNotFoundError”
我一直在使用枕头来完成这个工作,我尝试了许多其他库直接从github和他们都没有工作。随着枕头,我得到这个错误:
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
方法的错误,我不能左右我的头来解决这个问题。对此有何建议?
这是我使用的代码:
myText = image_to_string(Image.open(filePath))
filePath
是图片路径。
P.S:验证码图片:http://imgur.com/dRmna1z
它只会出现那个'filePath'不正确,或以其他方式不存在的。 – Evert
错误消息说您的代码是'myText = image_to_string(Image.open(filePath),config =' - psm 10')' –
尝试了2种方式。我发布的一个和另一个命令来检查它错误的地方。现在这个错误已经修复了 – Xonshiz