对于出现no module not found error的情况一般的解决办法就是使用hidden imports参数
当前对于这种问题的解决方法就是将所有缺少的模块用hidden imports给加进去,当然手动加有些麻烦,
故参考博文https://stackoverflow.com/questions/53149750/something-wrong-with-how-im-bundling-rasterio-into-an-executable给出的解决方法:
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
import glob, os
rasterio_imports_paths = glob.glob(r'E:\Software\anaconda3\envs\CAT2\Lib\site-packages\rasterio\*.py')
rasterio_imports = ['rasterio._shim', 'rasterio.control']
for item in rasterio_imports_paths:
current_module_filename = os.path.split(item)[-1]
current_module_filename = 'rasterio.'+current_module_filename.replace('.py', '')
rasterio_imports.append(current_module_filename)
a = Analysis(['sampl