1、因为是内网环境,与阿里的技术测试私有pip源搞了两天,需要绑定IP白名单,还需要申请账户密码;
2、PPU-V1.7.0 PIP包清单-PG1阿里云产品-阿里云-真武 PPU 云服务(ppu)-阿里云帮助中心
以上是兼容性列表,结合操作系统版本、cuda版本和PPU固件版本,只能安装paddleocr 3.2.0和paddlepaddle-gpu 3.2.2
3、pip install paddleocr==3.2 -i xxx
pip install paddlepaddle-gpu==3.2.2 -i xxx
指定阿里给的私有镜像源安装
4、python import paddleocr提示libavcodec.so.61不存在
>>> from paddleocr import PaddleOCR No model hoster is available! Please check your network connection to one of the following model hosts: HuggingFace (https://huggingface.co), ModelScope (https://modelscope.cn), AIStudio (https://aistudio.baidu.com), or BOS (https://paddle-model-ecology.bj.bcebos.com). Otherwise, only local models can be used. Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.12/site-packages/paddleocr/init.py", line 15, in <module> from paddlex.inference.utils.benchmark import benchmark File "/usr/local/lib/python3.12/site-packages/paddlex/init.py", line 49, in <module> from .inference import create_pipeline, create_predictor File "/usr/local/lib/python3.12/site-packages/paddlex/inference/init.py", line 16, in <module> from .models import create_predictor File "/usr/local/lib/python3.12/site-packages/paddlex/inference/models/init.py", line 26, in <module> from .anomaly_detection import UadPredictor File "/usr/local/lib/python3.12/site-packages/paddlex/inference/models/anomaly_detection/init.py", line 15, in <module> from .predictor import UadPredictor File "/usr/local/lib/python3.12/site-packages/paddlex/inference/models/anomaly_detection/predictor.py", line 19, in <module> from ....modules.anomaly_detection.model_list import MODELS File "/usr/local/lib/python3.12/site-packages/paddlex/modules/init.py", line 16, in <module> from .anomaly_detection import UadDatasetChecker, UadEvaluator, UadExportor, UadTrainer File "/usr/local/lib/python3.12/site-packages/paddlex/modules/anomaly_detection/init.py", line 15, in <module> from .dataset_checker import UadDatasetChecker File "/usr/local/lib/python3.12/site-packages/paddlex/modules/anomaly_detection/dataset_checker/init.py", line 21, in <module> from .dataset_src import anaylse_dataset, check_dataset, convert_dataset, split_dataset File "/usr/local/lib/python3.12/site-packages/paddlex/modules/anomaly_detection/dataset_checker/dataset_src/init.py", line 17, in <module> from .check_dataset import check_dataset File "/usr/local/lib/python3.12/site-packages/paddlex/modules/anomaly_detection/dataset_checker/dataset_src/check_dataset.py", line 26, in <module> from .utils.visualizer import visualize File "/usr/local/lib/python3.12/site-packages/paddlex/modules/anomaly_detection/dataset_checker/dataset_src/utils/visualizer.py", line 21, in <module> import cv2 File "/usr/local/lib/python3.12/site-packages/cv2/init.py", line 181, in <module> bootstrap() File "/usr/local/lib/python3.12/site-packages/cv2/init.py", line 153, in bootstrap native_module = importlib.import_module("cv2") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ImportError: libavcodec.so.61: cannot open shared object file: No such file or directory
5、通过apt源安装ffmpeg,安装之后还是报上面的错误,在/usr/lib/x86_64-linux-gnu/下面看到的libavcodec版本是libavcodec.so.60。
6、因为通过源安装ffmpeg,默认版本是ffmpeg6,但libavcodec.so.61需要ffmpeg7版本,阿里、清华等源没有7版本,需要手动安装。
bash
wget https://ffmpeg.org/releases/ffmpeg-7.1.tar.xz
tar xf ffmpeg-7.1.tar.xz
cd ffmpeg-7.1
./configure --prefix=/usr/local
make -j$(nproc)
sudo make install
安装过程可能提示缺一些别的系统包,用apt安装即可。