fastapi程序用PyInstaller 打包报错: Error loading ASGI app. Could not import m

1、程序

仅有一个main.py

2、起初打包命令

pyinstaller --onefile main.py

用改命令打包运行后报错:Error loading ASGI app. Could not import module "main".

3、解决

在运行 PyInstaller 命令时,使用 --hidden-import 选项显式地指定要导入的模块。

pyinstaller --onefile --hidden-import main main.py


发表评论

评论列表,共 0 条评论

    暂无评论