吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2181|回复: 10
收起左侧

[求助] [Python3]OCR pytesseract安装

[复制链接]
刹那光华 发表于 2022-2-21 23:13
python版本3.8

代码如下
[Python] 纯文本查看 复制代码
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)


运行报错内容如下
[Asm] 纯文本查看 复制代码
Traceback (most recent call last):
  File "d:/VSCodePython/OCR识别/test.py", line 2, in <module>
    import pytesseract
ModuleNotFoundError: No module named 'pytesseract'


尝试使用
[Python] 纯文本查看 复制代码
pip install pytesseract
命令重新安装
提示内容如下
[Asm] 纯文本查看 复制代码
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)


后面尝试使用
[Asm] 纯文本查看 复制代码
conda install pytesseract

提示内容如下
[Asm] 纯文本查看 复制代码
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:

  - [url]https://repo.anaconda.com/pkgs/main/win-64[/url]
  - [url]https://repo.anaconda.com/pkgs/main/noarch[/url]
  - [url]https://repo.anaconda.com/pkgs/r/win-64[/url]
  - [url]https://repo.anaconda.com/pkgs/r/noarch[/url]
  - [url]https://repo.anaconda.com/pkgs/msys2/win-64[/url]
  - [url]https://repo.anaconda.com/pkgs/msys2/noarch[/url]

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    [url]https://anaconda.org[/url]

and use the search bar at the top of the page.


使用powerShell可以正常运行输出结果
[Asm] 纯文本查看 复制代码
PS C:\Users\96538\Desktop> python
Python 3.8.1 (default, Mar  2 2020, 13:06:26) [MSC v.1916 64 bit (AMD64)] :: 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)

免费评分

参与人数 1吾爱币 +1 热心值 +1 收起 理由
为之奈何? + 1 + 1 我很赞同!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

ID88512 发表于 2022-2-21 23:30
平时我在pip基本安装什么都失败  但是在写代码那个里面  我比如调用某个没有的模块 它就会报错 点 报错那个灯里面的安装就可以成功安装

免费评分

参与人数 1吾爱币 +1 热心值 +1 收起 理由
刹那光华 + 1 + 1 热心回复!

查看全部评分

 楼主| 刹那光华 发表于 2022-2-22 01:17
pycham下面的Python Packages里面的PyPI仓库找到pytesseract选择安装就好了
CRG_44 发表于 2022-2-22 08:56
a5228172 发表于 2022-2-22 09:16
准确率咋样
Romeo_Ahmed 发表于 2022-2-22 09:42
这就是我用conda的原因
夏末青 发表于 2022-2-22 10:42
Romeo_Ahmed 发表于 2022-2-22 09:42
这就是我用conda的原因

我也用conda
1e3e 发表于 2022-2-22 10:46
aarch64 arm系统安装不了,楼主这个教程我恐怕用不上
 楼主| 刹那光华 发表于 2022-2-22 18:14
CRG_44 发表于 2022-2-22 08:56
话说这个环境包是干嘛的呢?

tesseract-ocr 光学识别
 楼主| 刹那光华 发表于 2022-2-22 18:16
Romeo_Ahmed 发表于 2022-2-22 09:42
这就是我用conda的原因

我试了conda也没用
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-25 16:31

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表