首页 > 解决方案 > python应用程序的依赖跟踪

问题描述

我正在尝试从使用 python3.4 在 Windows 7 - 32 位上开发的 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 的列表?

标签: python-3.4py2exegdalrasterio

解决方案


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

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


推荐阅读