我正在使用 Pyinstaller 构建一个 python exe,它工作正常,但是当我尝试执行程序的编译版本时,它失败了。
ModuleNotFoundError: No module named 'psycopg2'
[16803] Failed to execute script main
我尝试运行该命令但不起作用
pyinstaller ../Main/main.py --hidden-import=psycopg2 --onefile
这里我留下main.spec文件
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['../Main/main.py'],
pathex=['/home/eureka/Documents/ETL_Yalla/Exe'],
binaries=[],
datas=[],
hiddenimports=['psycopg2'],
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,
a.binaries,
a.zipfiles,
a.datas,
[],
name='main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True )
你能找到解决这个问题的方法吗,我也面临着同样的问题?