[Python3]OCR pytesseract安装
python版本3.8代码如下from PIL import Image
import pytesseract
text = pytesseract.image_to_string(Image.open(r'C:\Users\96538\Desktop\1.png'),lang='chi_sim')
print(text)
运行报错内容如下
Traceback (most recent call last):
File "d:/VSCodePython/OCR识别/test.py", line 2, in <module>
import pytesseract
ModuleNotFoundError: No module named 'pytesseract'
尝试使用pip install pytesseract命令重新安装
提示内容如下
Requirement already satisfied: pytesseract in d:\miniconda3\lib\site-packages (0.3.9)
Requirement already satisfied: packaging>=21.3 in d:\miniconda3\lib\site-packages (from pytesseract) (21.3)
Requirement already satisfied: Pillow>=8.0.0 in d:\miniconda3\lib\site-packages (from pytesseract) (9.0.1)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in d:\miniconda3\lib\site-packages (from packaging>=21.3->pytesseract) (3.0.7)
后面尝试使用conda install pytesseract
提示内容如下
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- pytesseract
Current channels:
- https://repo.anaconda.com/pkgs/main/win-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/win-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/msys2/win-64
- https://repo.anaconda.com/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
使用powerShell可以正常运行输出结果
PS C:\Users\96538\Desktop> python
Python 3.8.1 (default, Mar2 2020, 13:06:26) :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image
>>> import pytesseract
>>> text = pytesseract.image_to_string(Image.open(r'C:\Users\96538\Desktop\1.png'),lang='chi_sim')
>>> print(text) 平时我在pip基本安装什么都失败但是在写代码那个里面我比如调用某个没有的模块 它就会报错 点 报错那个灯里面的安装就可以成功安装
pycham下面的Python Packages里面的PyPI仓库找到pytesseract选择安装就好了 话说这个环境包是干嘛的呢? 准确率咋样 这就是我用conda的原因{:301_997:} Romeo_Ahmed 发表于 2022-2-22 09:42
这就是我用conda的原因
我也用conda aarch64 arm系统安装不了,楼主这个教程我恐怕用不上 CRG_44 发表于 2022-2-22 08:56
话说这个环境包是干嘛的呢?
tesseract-ocr 光学识别 Romeo_Ahmed 发表于 2022-2-22 09:42
这就是我用conda的原因
我试了conda也没用{:1_937:}
页:
[1]
2