所以,我有這個驗證碼,我需要從中提取文本。枕頭(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