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

Mac M1 Max运行Python Azure函数遇架构不支持问题求助

M1 Max MacBook Pro 运行Python版Azure函数报错求助

设备:MacBook Pro (16-inch, 2021) Apple M1 Max
需求:运行Python版Azure函数
背景:已知Azure Functions Core Tools暂不支持ARM64设备的Python函数开发,需在x86模拟环境运行,已按官方文档完成以下操作:

  1. 安装Homebrew;
  2. 通过Rosetta打开终端;
  3. 在Visual Studio Code中启用x86模拟;
  4. 配置VS Code的settings.json:
{
    "azureFunctions.deploySubpath": ".",
    "azureFunctions.scmDoBuildDuringDeployment": true,
    "azureFunctions.pythonVenv": ".venv",
    "azureFunctions.projectLanguage": "Python",
    "azureFunctions.projectRuntime": "~4",
    "debug.internalConsoleOptions": "neverOpen",
    "terminal.integrated.profiles.osx": {
       "rosetta": {
         "path": "arch",
         "args": ["-x86_64", "zsh", "-l"],
         "overrideName": true
       }
     }
}
  1. 在项目根目录配置.zshrc文件:
# rosetta terminal setup
if [ $(arch) = "i386" ]; then
    alias python="/usr/local/bin/python3"
    alias brew86='/usr/local/bin/brew'
    alias pyenv86="arch -x86_64 pyenv"
    alias func="/usr/local/Cellar/azure-functions-core-tools@4/4.0.5095/func"
fi

验证:VS Code的Rosetta终端执行arch命令返回i386,确认已处于x86模拟状态;
6. 将opt/homebrew/Cellar/azure-functions-core-tools@4/4.0.5095目录复制到/usr/local/Cellar/azure-functions-core-tools@4/4.0.5095/。

但执行func host start命令时仍报错:

Failed to initialize worker provider for: /usr/local/Cellar/azure-functions-core-tools@4/4.0.5095/workers/python
Microsoft.Azure.WebJobs.Script: Architecture Arm64 is not supported for language python.

当前项目的host.json配置如下:

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[3.*, 4.0.0)"
  }
}

已尝试多数在线解决方案但仍未解决,请问我的操作是否存在错误或遗漏了关键步骤?


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.25 05:22:54