pyinstaller 打包会报onnxruntime-gpu时缺少onnxruntime-cuda的动态库。打包时加上动态库就可以了。
使用--add-binary。如下图所示,首先第一入参是依赖库的位置,第二个入参是打包exe指定依赖库的位置
pyinstaller --add-binary "D:/soft/Anaconda3/envs/pyinstaller/Lib/site-packages/onnxruntime/capi/onnxruntime_providers_cuda.dll;./onnxruntime/capi" --add-binary "D:/soft/Anaconda3/envs/pyinstaller/Lib/site-packages/onnxruntime/capi/onnxruntime_providers_shared.dll;./onnxruntime/capi"