Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

按照安装指导安装后执行指定无任何反应,大佬们给指导指导 #60

Closed
BotAndyGao opened this issue Sep 3, 2024 · 7 comments · Fixed by #63
Closed

Comments

@BotAndyGao
Copy link
Contributor

0. 安装环境

  • 硬件Windows 10
  • 软件Python 3.10.14
  • 运行环境 Anaconda3

1. 安装与运行

1.1 安装PaddlePaddle

# 如果您的机器是CPU,请运行以下命令安装
pip3 install paddlepaddle==2.6.1 -i https://pypi.tuna.tsinghua.edu.cn/simple

1.2 安装与运行PPOCRLabel

PPOCRLabel可通过whl包与Python脚本两种方式启动,whl包形式启动更加方便,python脚本启动便于二次开发

1.2.1 通过whl包安装与运行

Windows
pip3 install PPOCRLabel  # 安装

# 选择标签模式来启动
PPOCRLabel --lang ch  # 启动【普通模式】,用于打【检测+识别】场景的标签
PPOCRLabel --lang ch --kie True  # 启动 【KIE 模式】,用于打【检测+识别+关键字提取】场景的标签
正常安装paddlepaddle==2.6.1
  • 2、执行命令:pip3 install PPOCRLabel
Installing collected packages: pytz, PyQt5-Qt5, pyclipper, lmdb, urllib3, tzdata, termcolor, soupsieve, six, rapidfuzz, pyyaml, PyQt5-sip, pyparsing, packaging, numpy, networkx, more-itertools, lxml, kiwisolver, fonttools, et-xmlfile, cython, cycler, cssselect, colorama, charset-normalizer, cachetools, tqdm, tifffile, shapely, scipy, requests, python-docx, python-dateutil, pyqt5, openpyxl, opencv-python, opencv-contrib-python, lazy-loader, imageio, fire, cssutils, contourpy, beautifulsoup4, scikit-image, premailer, pandas, matplotlib, imgaug, paddleocr, PPOCRLabel
  Attempting uninstall: numpy
    Found existing installation: numpy 2.1.0
    Uninstalling numpy-2.1.0:
      Successfully uninstalled numpy-2.1.0
Successfully installed PPOCRLabel-2.1.6 PyQt5-Qt5-5.15.2 PyQt5-sip-12.15.0 beautifulsoup4-4.12.3 cachetools-5.5.0 charset-normalizer-3.3.2 colorama-0.4.6 contourpy-1.3.0 cssselect-1.2.0 cssutils-2.11.1 cycler-0.12.1 cython-3.0.11 et-xmlfile-1.1.0 fire-0.6.0 fonttools-4.53.1 imageio-2.35.1 imgaug-0.4.0 kiwisolver-1.4.5 lazy-loader-0.4 lmdb-1.5.1 lxml-5.3.0 matplotlib-3.9.2 more-itertools-10.4.0 networkx-3.3 numpy-1.26.4 opencv-contrib-python-4.10.0.84 opencv-python-4.10.0.84 openpyxl-3.1.5 packaging-24.1 paddleocr-2.8.1 pandas-2.2.2 premailer-3.10.0 pyclipper-1.3.0.post5 pyparsing-3.1.4 pyqt5-5.15.11 python-dateutil-2.9.0.post0 python-docx-1.1.2 pytz-2024.1 pyyaml-6.0.2 rapidfuzz-3.9.7 requests-2.32.3 scikit-image-0.24.0 scipy-1.14.1 shapely-2.0.6 six-1.16.0 soupsieve-2.6 termcolor-2.4.0 tifffile-2024.8.30 tqdm-4.66.5 tzdata-2024.1 urllib3-2.2.2
  • 3、执行命令:pip freeze
(PaddleOCRLabelWhl) E:\paddle>pip3 freeze
anyio==4.4.0
astor==0.8.1
beautifulsoup4==4.12.3
cachetools==5.5.0
certifi==2024.8.30
charset-normalizer==3.3.2
colorama==0.4.6
contourpy==1.3.0
cssselect==1.2.0
cssutils==2.11.1
cycler==0.12.1
Cython==3.0.11
decorator==5.1.1
et-xmlfile==1.1.0
exceptiongroup==1.2.2
fire==0.6.0
fonttools==4.53.1
h11==0.14.0
httpcore==1.0.5
httpx==0.27.2
idna==3.8
imageio==2.35.1
imgaug==0.4.0
kiwisolver==1.4.5
lazy_loader==0.4
lmdb==1.5.1
lxml==5.3.0
matplotlib==3.9.2
more-itertools==10.4.0
networkx==3.3
numpy==1.26.4
opencv-contrib-python==4.10.0.84
opencv-python==4.10.0.84
openpyxl==3.1.5
opt-einsum==3.3.0
packaging==24.1
paddleocr==2.8.1
paddlepaddle==2.6.1
pandas==2.2.2
pillow==10.4.0
PPOCRLabel==2.1.6
premailer==3.10.0
protobuf==3.20.2
pyclipper==1.3.0.post5
pyparsing==3.1.4
PyQt5==5.15.11
PyQt5-Qt5==5.15.2
PyQt5_sip==12.15.0
python-dateutil==2.9.0.post0
python-docx==1.1.2
pytz==2024.1
PyYAML==6.0.2
rapidfuzz==3.9.7
requests==2.32.3
scikit-image==0.24.0
scipy==1.14.1
shapely==2.0.6
six==1.16.0
sniffio==1.3.1
soupsieve==2.6
termcolor==2.4.0
tifffile==2024.8.30
tqdm==4.66.5
typing_extensions==4.12.2
tzdata==2024.1
urllib3==2.2.2
  • 4、执行命令:PPOCRLabel --lang ch
执行该命令后没有任何反应
@GreatV
Copy link
Collaborator

GreatV commented Sep 3, 2024

clone下来用python PPOCRLabel.py运行一下试试。

@BotAndyGao
Copy link
Contributor Author

clone下来用python PPOCRLabel.py运行一下试试。
好,我clone tagV2.1.6的代码试一下
准备使用环境:
python 3.10.14
opencv-contrib-python==4.10.0.84
opencv-python==4.10.0.84
paddleocr==2.8.1
paddlepaddle==2.6.1

@BotAndyGao
Copy link
Contributor Author

clone下来用python PPOCRLabel.py运行一下试试。

感谢支持!

源码下安装运行步骤

git clone PPOCRLabel源码

cd PPOCRLabel
 
pip3 install paddlepaddle==2.6.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
# 正常安装paddlepaddle==2.6.1

pip3 install paddleocr==2.8.1 -i https://pypi.tuna.tsinghua.edu.cn/simple

pip3 install openpyxl

# Successfully installed et-xmlfile-1.1.0 openpyxl-3.1.5

pip3 install PyQt5

# Successfully installed PyQt5-5.15.11 PyQt5-Qt5-5.15.2 PyQt5-sip-12.15.0

python PPOCRLabel.py

# 成功启动界面

@BotAndyGao
Copy link
Contributor Author

已解决

@BotAndyGao
Copy link
Contributor Author

1.2.4 Pyinstaller打包并运行

cd ./PPOCRLabel
# 安装pyinstaller
pip install pyinstaller

# 重新生成资源
pyrcc5 -o libs/resources.py resources.qrc

# 打包可执行程序
pyinstaller -c PPOCRLabel.py --collect-all paddleocr --collect-all pyclipper --collect-all imghdr --collect-all skimage --collect-all imgaug --collect-all scipy.io --collect-all lmdb --collect-all paddle --hidden-import=pyqt5  -p ./libs -p ./ -p ./data -p ./resources -F

# 运行dist中的可执行程序,以windows为例
PPOCRLabel.exe --lang ch

问题:按照1.2.4步骤在源码上打包,打包过程没问题,打包也成功。但是运行dist中的可执行程序时报错。希望大佬再给看看什么原因?

错误信息如下:

(PaddleOCRLadelTest) E:\temp\PPOCRLabel\dist>PPOCRLabel.exe --lang ch
Traceback (most recent call last):
  File "PPOCRLabel.py", line 68, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "paddleocr\__init__.py", line 14, in <module>
    from .paddleocr import *
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "paddleocr\paddleocr.py", line 59, in <module>
    from ppocr.utils.network import (
  File "C:\Users\gaoxu\AppData\Local\Temp\_MEI74762\paddleocr\ppocr\utils\network.py", line 18, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'
[PYI-12540:ERROR] Failed to execute script 'PPOCRLabel' due to unhandled exception!

@BotAndyGao BotAndyGao reopened this Sep 3, 2024
@GreatV
Copy link
Collaborator

GreatV commented Sep 3, 2024

你把缺的包安装上就好了,requests。

@BotAndyGao
Copy link
Contributor Author

你把缺的包安装上就好了,requests。

安装这个包应该很好操作,但是打包的问题别人也会遇到,后续会对这个问题做升级吧?要不别人都会出错,你们不也麻烦吗!

@GreatV GreatV mentioned this issue Sep 5, 2024
@GreatV GreatV closed this as completed in #63 Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants