我使用PyInstaller为Python-Django应用程序创建了可执行文件。我试图在docker中运行可执行文件,这给了我错误。这是缺少的dll:/home/user/app/mxnet/libmxnet.so',该文件已经存在于.exe文件夹中。
当不使用Docker运行时,exe文件将被执行。尝试手动安装mxnet并运行docker映像,但仍然无法工作
import mxnet
错误:
Performing system checks...
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f2a02dde510>
Traceback (most recent call last):
File "PyInstaller/loader/pyiboot01_bootstrap.py", line 149, in __init__
File "ctypes/__init__.py", line 347, in __init__
OSError: libgomp.so.1: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "django/utils/autoreload.py", line 227, in wrapper
File "django/core/management/commands/runserver.py", line 125, in inner_run
File "django/core/management/base.py", line 359, in check
File "django/core/management/base.py", line 346, in _run_checks
File "django/core/checks/registry.py", line 81, in run_checks
File "django/core/checks/urls.py", line 16, in check_url_config
File "django/core/checks/urls.py", line 26, in check_resolver
File "django/urls/resolvers.py", line 254, in check
File "django/utils/functional.py", line 35, in __get__
File "django/urls/resolvers.py", line 405, in url_patterns
File "django/utils/functional.py", line 35, in __get__
File "django/urls/resolvers.py", line 398, in urlconf_module
File "importlib/__init__.py", line 126, in import_module
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
File "app/urls.py", line 18, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
File "engine/urls.py", line 17, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
File "engine/views.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
File "engine/util.py", line 4, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
File "models.py", line 5, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
File "common_util.py", line 11, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
File "sap/train.py", line 21, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
File "sap/util.py", line 8, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
File "mxnet/__init__.py", line 24, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
File "mxnet/context.py", line 24, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "/usr/local/lib/python3.5/dist-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
File "mxnet/base.py", line 213, in <module>
File "mxnet/base.py", line 204, in _load_lib
File "PyInstaller/loader/pyiboot01_bootstrap.py", line 151, in __init__
__main__.PyInstallerImportError: Failed to load dynlib/dll '/home/akash/app/mxnet/libmxnet.so'. Most probably this dynlib/dll was not found when the application was frozen.