pyinstaller 打包 paddleocr

编程入门 行业动态 更新时间:2024-10-21 09:39:42

<a href=https://www.elefans.com/category/jswz/34/1752599.html style=pyinstaller 打包 paddleocr"/>

pyinstaller 打包 paddleocr

一、场景

我们在使用pyinstaller打包完以后,在执行时会出现一些第三方库找不到,尤其是paddleocr库

二、解决方法

在打包paddleocr的时候,他的一些模块不会跟着一起打包,我们要使用已下方法来进行打包处理
  1. 一般情况下打包
pyinstaller -F my_main.py
因为我们程序中使用了paddleocr库,所有这样打包是不行的要在后面加上 --add-data="需要打包的文件目录"
pyinstaller -F my_main.py --add-data="C:\\Users\\dell\\.conda\\envs\\py3.7.3\\Lib\\site-packages\\Shapely.libs;./Shapely.libs"
要是有多个的话就在后面累加
pyinstaller -F my_main.py --add-data="C:\\Users\\dell\\.conda\\envs\\py3.7.3\\Lib\\site-packages\\Shapely.libs;./Shapely.libs" --add-data="C:\\Users\\dell\\.conda\\envs\\py3.7.3\\Li
b\\site-packages\\paddle;./paddle" --add-data="C:\\Users\\dell\\.conda\\envs\\py3.7.3\\Lib\\site-packages\\paddleocr;./paddleocr" --add-data="C:\\Users\\dell\\.conda\\envs\\py3.7.3\\Lib\\site-packages\\PIL;./PIL" --add-data="C:
\\Users\\dell\\.conda\\envs\\py3.7.3\\Lib\\site-packages\\pywt;./pywt" --add-data="C:\\Users\\dell\\.conda\\envs\\py3.7.3\\Lib\\site-packages\\lmdb;./lmdb" --add-data="C:\\Users\\dell\\.conda\\envs\\py3.7.3\\Lib\\site-packages\
\shapely;./shapely" --add-data="C:\\Users\\dell\\.conda\\envs\\py3.7.3\\Lib\\site-packages\\skimage;./skimage" --add-data="C:\\Users\\dell\\.conda\\envs\\py3.7.3\\Lib\\site-packages\\pyclipper;./pyclipper" --add-data="C:\\Users
\\dell\\.conda\\envs\\py3.7.3\\Lib\\site-packages\\scipy;./scipy" --add-data="C:\\Users\\dell\\.conda\\envs\\py3.7.3\\Lib\\site-packages\\imgaug;./imgaug" --add-data="C:\\Users\\dell\\.conda\\envs\\py3.7.3\\Lib\\site-packages\\imageio;./imageio" --add-data="C:\\Users\\dell\\.conda\\envs\\py3.7.3\\Lib\\site-packages\\attrdict;./attrdict"
  1. 如果打包后还有问题,比如:No module named ‘imghdr’,解决方法如下
    找到打包之后的缓存文件 my_main.spec,在hiddenimports列表中添加没有命名的模块

    再次进行打包,注意:接下来打包就是从缓存文件中进行了
pyinstaller my_main.spec

如果还是不行就将已下代码添加到缓存文件的最上方

import sys ; sys.setrecursionlimit(sys.getrecursionlimit() * 5)

更多推荐

pyinstaller 打包 paddleocr

本文发布于:2023-11-16 02:30:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1611692.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:pyinstaller   paddleocr

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!