RuntimeError:找不到MXNet库

时间:2019-07-19 11:37:12

标签: python-3.x pyinstaller mxnet

我想为我在pyinstaller中使用mxnet的代码创建可执行文件。

我收到此错误

File "mxnet/libinfo.py", line 74, in find_lib_path
RuntimeError: Cannot find the MXNet library.
List of candidates:
/home/rit/test/exe/dist/test/libmxnet.so
/home/rit/test/exe/dist/test/libmxnet.so
/home/rit/test/exe/dist/test/mxnet/libmxnet.so
/home/rit/test/exe/dist/test/mxnet/../../lib/libmxnet.so
/home/rit/test/exe/dist/test/mxnet/../../build/libmxnet.so

通过规范文件添加了libmxnet.so,但给了我PyInstallerImportError

通过pip卸载了mxnet,并将python3.5 / dist-packages / mxnet复制到了我的项目中,面临同样的问题。

File "PyInstaller/loader/pyiboot01_bootstrap.py", line 151, in __init__
__main__.PyInstallerImportError: Failed to load dynlib/dll '/home/rit/test/exe/dist/test/libmxnet.so'. Most probably this dynlib/dll was not found when the application was frozen.

现在什么是dynlib / dll?如何解决此错误?

谢谢

1 个答案:

答案 0 :(得分:0)

MXNet冻结时需要外部二进制文件。您可以使用add-data标志将libmxnet文件添加到可执行文件中:

pyinstaller -F --add-data="<python_path>/lib/python3.7/site-packages/mxnet/*.so*:./mxnet" script.py