37,742
社区成员
发帖
与我相关
我的任务
分享
from PIL import Image
import pytesseract
#pytesseract.pytesseract.tesseract_cmd = "C:\\Program Files (x86)\\Tesseract-OCR\\tessdata"
text=pytesseract.image_to_string(Image.open('en.png'),lang='chi_sim')
print(text)
Windows PowerShell
版权所有 (C) Microsoft Corporation。保留所有权利。
PS C:\Users\administration\Desktop\pythoncode> & C:/Users/administration/AppData/Local/Programs/Python/Python37-32/python.exe c:/Users/administration/Desktop/pythoncode/test.py
Traceback (most recent call last):
File "c:/Users/administration/Desktop/pythoncode/test.py", line 4, in <module>
text=pytesseract.image_to_string(Image.open('en.png'),lang='chi_sim')
File "C:\Users\administration\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pytesseract\pytesseract.py", line 347, in image_to_string
}[output_type]()
File "C:\Users\administration\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pytesseract\pytesseract.py", line 346, in <lambda>
Output.STRING: lambda: run_and_get_output(*args),
File "C:\Users\administration\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pytesseract\pytesseract.py", line 257, in run_and_get_output
run_tesseract(**kwargs)
File "C:\Users\administration\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pytesseract\pytesseract.py", line 228, in run_tesseract
raise e
File "C:\Users\administration\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pytesseract\pytesseract.py", line 225, in run_tesseract
proc = subprocess.Popen(cmd_args, **subprocess_args())
File "C:\Users\administration\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 756, in __init__
restore_signals, start_new_session)
File "C:\Users\administration\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 1155, in _execute_child
startupinfo)
PermissionError: [WinError 5] 拒绝访问。
PS C:\Users\administration\Desktop\pythoncode>
我的已经解决了: python安装文件夹:python.exe --属性---兼容性--以管理员身份运行此程序