小编Phi*_*ppe的帖子

文件 tesseract.exe 不存在

我已经pytesseract使用安装了该库

\n\n
pip install pytesseract\n
Run Code Online (Sandbox Code Playgroud)\n\n

当我尝试使用该image_to_text方法时,它给了我一个

\n\n
\n

FileNotFoundError: [WinError 2] 系统找不到指定的文件

\n
\n\n

我用谷歌搜索了一下,发现我应该更改 pytesseract.py 文件和行中的某些内容

\n\n
tesseract_cmd = \'tesseract\'\n
Run Code Online (Sandbox Code Playgroud)\n\n

应该成为

\n\n
tesseract_cmd = path_to_folder_that_contains_tesseractEXE + \'tesseract\'  \n
Run Code Online (Sandbox Code Playgroud)\n\n

我搜索并没有tesseract.exe在我的 Python 文件夹中找到任何文件,然后我重新安装了该库,但该文件仍然不存在。最后,我将该行替换为:

\n\n
tesseract_cmd = path_to_folder_that_contains_pytesseractEXE + \'pytesseract\'\n
Run Code Online (Sandbox Code Playgroud)\n\n

我的程序抛出:

\n\n
\n

pytesseract.pytesseract.TesseractError: (2, \'用法: python pytesseract.py [-l lang] input_file\')

\n
\n\n

我该怎么做才能让我的程序正常运行?

\n\n

PS这是我的程序代码:

\n\n
from pytesseract import image_to_string\nfrom PIL import Image, ImageEnhance, ImageFilter\n\nim = Image.open(r\'C:\\Users\\\xd0\xa4\xd0\xb8\xd0\xbb\xd0\xb8\xd0\xbf\xd0\xbf\\Desktop\\ImageToText_Python\\NoName.png\') \nprint(im)\n\ntxt = image_to_string(im)\nprint(txt)\n
Run Code Online (Sandbox Code Playgroud)\n\n …

python python-3.x

6
推荐指数
1
解决办法
2万
查看次数

pyTelegramBotAPI 禁用链接预览

目前正在使用pyTelegramBotAPI编写我的第一个机器人。我想禁用某些消息的链接预览。我该怎么做呢?

python python-3.x telegram telegram-bot py-telegram-bot-api

3
推荐指数
1
解决办法
5554
查看次数