torch/lib/libtorch_python.so: undefined symbol: _ZN3c1019ConstantSymNodeImplIlE2eqERKNS
Pytorch Implementation For LPRNet, A High Performance And Lightweight License Plate Recognition Framework.
完全适用于中国车牌识别(Chinese License Plate Recognition)及国外车牌识别!
目前仅支持同时识别蓝牌和绿牌即新能源车牌等中国车牌,但可通过扩展训练数据或微调支持其他类型车牌及提高识别准确率!
LPRNet的环境 运行train的时候,每次都报这个问题
之前搭好的环境好长时间没用了,准备跑训练的时候报了如下问题:试了很多方法,包括libtorch_python.so增加到环境变量bashrc中,包括重装torch结果一顿操作猛如虎,问题越来越多。
torch/lib/libtorch_python.so: undefined symbol: _ZN3c1019ConstantSymNodeImplIlE2eqERKNS_13intrusive_ptrINS_11SymNodeImplENS_6detail34intrusive_target_default_null_typeIS3_EEEE
最后的解决办法是重新新建安装整个lprnet的环境,安装过程如下:
(1)删除虚拟环境
conda remove -n lprnet --all
(2)新建虚拟环境
conda create --name lprnet_env python=3.8 -y
conda activate lprnet_env
安装 pytorch >= 1.0.0
pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu118
装好之后,通过python命令查看,依次输入如下命令:
python
输出如下
Python 3.8.18 (default, Sep 11 2023, 13:40:15)
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
导入torch库查看版本
import torch
print(torch.cuda.is_available(), torch.version.cuda, torch.__version__)
可以看到,打印的输出如下:
True 10.2 1.9.0+cu102
然后通过 ‘exit()’ 退出python命令行。
安装 opencv-python 3.x ,imutils ,Pillow ,numpy
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python
pip3 install imutils -i https://pypi.tuna.tsinghua.edu.cn/simple
# Pillow ,numpy包在新建虚拟环境或装pytorch的时候就已经装好了, 无需再装
# pip3 install Pillow -i https://pypi.tuna.tsinghua.edu.cn/simple
# pip3 install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple