我想出的当前解决方案是强制使用该程序包中的
hidden-imports所有模块供稿变量。在我的规格文件中,我添加了一些python代码来执行此 *** 作:
C:ProgramDataAnaconda2envswps_env36Libsitepackagesrasterio``glob
# -*- mode: python -*-block_cipher = Noneimport glob, osrasterio_imports_paths = glob.glob(r'C:ProgramDataAnaconda2envswps_env36Libsite-packagesrasterio*.py')rasterio_imports = ['rasterio._shim']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(['workflow_3.py'], pathex=['D:202750-002_RA2CE\Basis'], binaries=[], datas=[], hiddenimports=rasterio_imports, hookspath=[], runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher, noarchive=False)pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)exe = EXE(pyz, a.scripts, [], exclude_binaries=True, name='workflow_3', debug=True, bootloader_ignore_signals=False, strip=False, upx=True, console=True )coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas, strip=False, upx=True, name='workflow_3')
不幸的是,这并不能解释为什么
pyinstaller最初无法看到这些模块。但是,它确实可以立即解决此问题,并且代码可以正常编译。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)