python 应用程序的依赖项跟踪

Dependencies tracking on python application

我正在尝试从我在 Windows 7 - 32 位上使用 python3.4 开发的 python 应用程序制作一个便携式应用程序。我的第一个想法是将 py2exe 与 ThinApp 等效项结合使用,但由于我使用的不是纯 python 库的 rasterio,py2exe 无法找到一些 DLL。 如果我尝试 运行 生成的可执行文件,我会收到此错误:

File Traceback (most recent call last):
  File "viewer.py", line 3, in <module>
    import MainWindow as GUI
  File "C:\Users\IEUser\Documents\viewer-dev\viewer\MainWindow.py", line 2, in <module>
    import ImageWindow
  File "C:\Users\IEUser\Documents\viewer-dev\viewer\ImageWindow.py", line 1, in <module>
    import Resampler
  File "C:\Users\IEUser\Documents\viewer-dev\viewer\Resampler.py", line 1, in <module>
    import rasterio
  File "C:\Python34\lib\site-packages\rasterio\__init__.py", line 31, in <module>
    from rasterio._base import gdal_version
  File "<loader>", line 10, in <module>
  File "<loader>", line 8, in __load
ImportError: (DLL load failed: The specified module could not be found.) 'C:\Users\IEUser\Documents\viewer-dev\dist\rasterio._base.pyd'

我读到我必须在 dist 目录中手动添加这些 DLL,但我想知道如何才能获得所需 DLL 的列表?

您可以在 py2exe 上使用 Dependency Walker 查看所有缺少的依赖项。

检查可执行文件和所有链接库(PYD 和 DLL 文件)