我正在使用 Visual Studio 代码,并在 Ubuntu 上安装了 Python 扩展,我创建了一个名为“image_extraction”的 Python 文件并安装了 selenium、fuzzy-wuzzy 和其他模块。
除了 pytesseract 之外,一切都工作正常,尽管终端显示 pyterresract 已成功安装
我的Python脚本:
import pytesseract
from PIL import Image
# Load image using Pillow library
image = Image.open('web_screenshot.png')
# Convert image to text using pytesseract library
text = pytesseract.image_to_string(image)
# Print extracted text
print(text)
我收到以下错误:
ModuleNotFoundError:没有名为“pytesseract”的模块
到目前为止我为解决此问题所采取的步骤:
我使用 pip install pytesseract 从虚拟环境(venv)内部安装了 pytesseract,
我查看了“site-packages”文件夹(..\Local\Continuum naconda3 nvs env\Lib\site-packages),我确实看到“pytesseract”文件夹确实与“pytesseract-0.2.0”一起存在于其中.dist-info”。请注意,这也是我可以看到“selenium”和其他运行完美的模块的文件夹。
我安装 Pillow 只是为了确保。
我在网上研究了同样的错误,找到了解决方案,指出我应该 pip install pytesseract 并检查 pytesseract 是否存在于我尝试运行的虚拟环境的“站点包”中,这两个步骤我已经完成了已拍摄。
我还安装了 tesseract-OCR 版本 3.05.01,默认情况下位于“C:\Program Files (x86)”
如果我尝试在“ModuleNotFoundError”下方再次运行 pip install pytesseract,我会收到以下消息:
已满足要求:c:\users\stan ppdata\loca 中的 pytesseract