我如何知道在使用cx\U冻结的python中缺少哪个.dll?

2024-09-29 23:23:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个项目,我包装与cx_冻结。当我尝试运行生成的exe时,我得到一个ImportError: DLL load failed: The specified module could not be found.

这是我的setup.py:

from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but it might need
# fine tuning.
buildOptions = dict(build_exe='liquidation', packages=['scipy', 'numpy'], excludes=['scipy.spatial.cKDTree'],
                    includes=['scipy', 'numpy', 'numpy.core._methods', 'scipy.sparse.csgraph._validation',
                              'numpy.lib.format', 'numpy.linalg._umath_linalg', 'scipy.sparse._csparsetools',
                              'scipy.sparse.linalg.isolve._iterative', 'scipy.sparse.linalg.eigen.arpack._arpack',
                              'scipy.special._ufuncs_cxx', 'scipy.special.specfun', 'scipy.integrate._odepack',
                              'scipy.integrate._quadpack', 'scipy.integrate.vode', 'scipy.integrate._dop',
                              'scipy.integrate.lsoda', 'scipy.optimize._minpack', 'scipy.optimize._zeros',
                              'scipy.spatial', 'scipy.spatial.ckdtree', 'scipy.spatial.kdtree',
                              'scipy._distributor_init', 'numpy.core._multiarray_umath'])

base = 'Console'

executables = [
    Executable('liquidation.py', base=base, targetName='liquidation.exe')
]

setup(name='liquidation',
      version='2.0',
      description='Program to run and test Liquidation algorithms',
      options=dict(build_exe=buildOptions),
      executables=executables)

当我运行python setup.py build_exe时,它似乎成功完成,但当我运行exe时,我得到以下输出:

Traceback (most recent call last):
  File "C:\Users\tamar\PycharmProjects\liquidation\venv\lib\site-packages\numpy\core\__init__.py", line 24, in <module>
    from . import multiarray
  File "C:\Users\tamar\PycharmProjects\liquidation\venv\lib\site-packages\numpy\core\multiarray.py", line 14, in <module>
    from . import overrides
  File "C:\Users\tamar\PycharmProjects\liquidation\venv\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\tamar\PycharmProjects\liquidation\venv\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 40, in run
    module.run()
  File "C:\Users\tamar\PycharmProjects\liquidation\venv\lib\site-packages\cx_Freeze\initscripts\Console.py", line 37, in run
    exec(code, {'__name__': '__main__'})
  File "liquidation.py", line 64, in <module>
    from io_tools.stock_wrapper import StockWrapper
  File "C:\Users\tamar\PycharmProjects\liquidation\io_tools\stock_wrapper.py", line 4, in <module>
    from io_tools.io_helper import *
  File "C:\Users\tamar\PycharmProjects\liquidation\io_tools\io_helper.py", line 7, in <module>
    from numpy import float_
  File "C:\Users\tamar\PycharmProjects\liquidation\venv\lib\site-packages\numpy\__init__.py", line 142, in <module>
    from . import core
  File "C:\Users\tamar\PycharmProjects\liquidation\venv\lib\site-packages\numpy\core\__init__.py", line 54, in <module>
    raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
  1. Check that you expected to use Python3.7 from "C:\Users\tamar\PycharmProjects\liquidation\liquidation\liquidation.exe",
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy version "1.18.3" you're trying to use.
  2. If (1) looks fine, you can open a new issue at
     https://github.com/numpy/numpy/issues.  Please include details on:
     - how you installed Python
     - how you installed numpy
     - your operating system
     - whether or not you have multiple versions of Python installed
     - if you built from source, your compiler versions and ideally a build log

- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.

Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.

Original error was: DLL load failed: The specified module could not be found.

我知道我需要将cx_freeze指向丢失的DLL(通过将它们添加到buildOptions.include_files或通过实际将DLL复制到构建文件夹),但我不知道如何知道我丢失了哪个DLLnumpy.core._multiarray_umath在build文件夹中,所以我不知道它可能是什么

我相信我使用的是最新版本的numpy(1.18.3)、scipy(1.4.1)和cx freeze(6.1)。任何帮助都将不胜感激

更新:我使用Dependency Walker尝试查看我缺少的内容,它列出了一个名为LIBOPENBLAS.SVHFG5YE3RK3Z27NVFUDAPL2O3W6IMXW.GFORTRAN-WIN32.DLL的文件,但找不到该文件。所有其他依赖项都已复制到构建中,因此,这可能是缺少的依赖项。有人知道我在哪里可以找到这个文件吗


Tags: infrompycoreimportnumpyyouline

热门问题