ModuleNotFoundError:没有名为'pytesseract'的模块

问题描述 投票:3回答:1

我在Windows 10上使用Anaconda Navigator 1.7.0,我创建了一个名为“venv”的虚拟环境,并在其中安装了Python版本3.5.2以及selenium,fuzzywuzzy和其他模块。

一切都很好,除了pytesseract。

我的python脚本:

import pytesseract

from PIL import Image

im =Image.open("C:\\Users\\stan\\Desktop\\sample.jpg")
text = pytesseract.image_to_string(im, lang ='eng')
print(text)

我得到以下错误:

Traceback (most recent call last):
  File "C:\Users\stan\MyPythonScripts\tess11.py", line 1, in <module>
    import pytesseract
ModuleNotFoundError: No module named 'pytesseract'

我使用pip install来安装所有模块。

到目前为止我采取的解决方案:

  1. 我在虚拟环境(venv)中使用pip install pytesseract在虚拟env中安装了pytesseract,
  2. 我查看了“site-packages”文件夹(.. \ Local \ Continuum \ anaconda3 \ envs \ venv \ Lib \ site-packages),我确实看到“pytesseract”文件夹与“pytesseract-0.2.0”一起存在.dist-信息”。请注意,这也是我可以看到“selenium”和其他运行完美的模块的文件夹。
  3. 我安装Pillow只是为了确保。
  4. 我在网上研究了同样的错误,并找到了解决方案,说明我应该pip install pytesseract并检查pytesseract是否存在于我试图运行的虚拟环境的“site-packages”中,这两个步骤我已经采取了。
  5. 我还安装了tesseract-OCR版本3.05.01,默认情况下位于“C:\ Program Files(x86)”中
  6. 如果我尝试在“ModuleNotFoundError”下面再次运行pip install pytesseract,我会收到以下消息: 要求已满足:c:\ users \ stan \ appdata \ local \ continuum \ anaconda3 \ envs \ venv \ lib \ site-packages中的pytesseract(0.2.0)已满足要求:c:\ users \ stan \ appdata \中的枕头local \ continuum \ anaconda3 \ envs \ venv \ lib \ site-packages(来自pytesseract)(5.1.0)
  7. 我还尝试卸载pytesseract并手动删除系统中包含pytesseract的任何文件名,然后再次安装pytesseract。

任何人都可以建议我可能会缺少什么,或者指出我可以研究这个主题的方向吗?

除了pip install之外,还有其他方法可以安装pytesseract,这可能有助于这种情况吗?

python python-3.x anaconda python-tesseract
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.