You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

部署Firebase Python函数时遇'determining Python exec prefix: []'错误求助

Firebase Functions部署Python函数报错:determining Python exec prefix: []

问题描述

我使用Python 3.12.3,通过firebase deploy --only functions命令部署Firebase Functions,最简可复现代码如下:

from firebase_functions import https_fn

@https_fn.on_request()
def hello_world(req: https_fn.Request) -> https_fn.Response:
    return https_fn.Response("Hello, World!")

但每次都出现构建失败错误:

Build failed with status: FAILURE and message: failed to build: determining Python exec prefix: []

已多次删除venv目录重试,问题仍未解决,且日志无更多相关信息。

解决方法

  • 确认Python版本兼容性:Firebase Functions官方目前仅支持Python 3.8、3.9、3.10、3.11,Python 3.12不在支持范围内,这是导致报错的主要原因。
  • 降级Python版本到官方支持的版本(比如3.11.x),重新配置环境:
    1. 安装Python 3.11.x版本(卸载或停用Python 3.12)
    2. 删除现有venv目录,执行python -m venv venv创建新虚拟环境
    3. 激活虚拟环境后,重新安装依赖:pip install firebase-functions firebase-admin
  • 检查firebase.json配置,确保functions的目录路径正确
  • 部署前执行firebase functions:log,尝试获取更详细的构建日志排查隐藏问题

内容的提问来源于stack exchange,提问作者Raul Ponzheimer

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 23:20:58