pyinstaller 无法打包 import paddle

b4lqfgs4  于 4个月前  发布在  其他
关注(0)|答案(7)|浏览(39)

请提出你的问题 Please ask your question

使用conda环境安装了paddle cpu 2.5.0版本,我的工程目录如下:

我的main函数仅仅是import paddle并使用paddle.verison

在conda环境下运行main函数运行正常:

使用最简单的打包命令:

在dist文件夹下也能找到paddle包:

运行./dist/test/test失败:
./dist/test/test
Traceback (most recent call last):
File "test.py", line 1, in
import paddle
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
File "paddle/init.py", line 31, in
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
File "paddle/framework/init.py", line 17, in
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
File "paddle/framework/random.py", line 17, in
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
File "paddle/fluid/init.py", line 36, in
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
File "paddle/fluid/framework.py", line 35, in
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
File "paddle/fluid/core.py", line 394, in
File "paddle/fluid/core.py", line 386, in set_paddle_lib_path
TypeError: sequence item 0: expected str instance, NoneType found
[56416] Failed to execute script 'test' due to unhandled exception!
此外也尝试在anaconda/envs/fast/lib/python3.7/site-packages中找到paddle和paddleocr文件夹拷贝到dist/test/文件夹下:

依旧无法运行,出现同样的错误

yrwegjxp

yrwegjxp1#

一样的问题,请问现在解决了吗

00jrzges

00jrzges2#

Ubuntu下Import paddle后面没有尝试了,fastdeploy版本的推理可以打包,openvino推理,把site-packages下面那些openvino的动态库放进去就可以了。或者你在windows下试试Qpt,参考 https://www.bilibili.com/video/BV16r4y1W7uv

jhdbpxl9

jhdbpxl93#

一样的问题,请问现在解决了吗

Ubuntu下Import paddle后面没有尝试了,fastdeploy版本的推理可以打包,openvino推理,把site-packages下面那些openvino的动态库放进去就可以了。或者你在windows下试试Qpt,参考 https://www.bilibili.com/video/BV16r4y1W7uv

8yoxcaq7

8yoxcaq74#

一样的问题,请问现在解决了吗

fastdeploy用openvino或者TRT推理,绕过了import paddle,后面服务化部署你需要自己在外面包一层web服务

7vux5j2d

7vux5j2d7#

我也遇到一样的问题,难道是paddle不能pyinstaller吗?

相关问题