gpt4 book ai didi

azure - VSCode 中的 Python Azure Function (HTTPTrigger) 调试未正确启动 Func Host Start

转载 作者:行者123 更新时间:2023-12-02 08:02:13 24 4
gpt4 key购买 nike

问题: enter image description here

所有依赖项,如Python 3.6,Windows环境变量都已设置,必要的requirement.txt已手动安装在我的.env(我的虚拟环境)中,API客户端已安装,

错误:我得到如下 h

我的 launch.json 看起来像这样,不知道如何解决这个问题 - 我怀疑 vscode 配置有问题

{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Python Functions",
"type": "python",
"request": "attach",
"port": 9091,
"host": "localhost",
"preLaunchTask": "runFunctionsHost"
}
]
}

感谢任何指导或帮助。

最佳答案

您可以将 .vscode/tasks.json 文件更新为类似的内容,以便使用 bash

{
"version": "2.0.0",
"tasks": [
{
"label": "runFunctionsHost",
"type": "shell",
"osx": {
"command": ". ${config:azureFunctions.pythonVenv}\\bin\\activate && func extensions install && pip install -r requirements.txt && func host start"
},
"windows": {
"command": ". ${config:azureFunctions.pythonVenv}/Scripts/activate ; func extensions install ; pip install -r requirements.txt ; func host start"
},
"linux": {
"command": ". ${config:azureFunctions.pythonVenv}\\bin\\activate && func extensions install && pip install -r requirements.txt && func host start"
},
"isBackground": true,
"options": {
"env": {
"languageWorkers__python__arguments": "-m ptvsd --host 127.0.0.1 --port 9091"
}
},
"problemMatcher": "$func-watch"
},
{
"label": "funcPack",
"type": "shell",
"osx": {
"command": ". ${config:azureFunctions.pythonVenv}\\bin\\activate && func pack"
},
"windows": {
"command": ". ${config:azureFunctions.pythonVenv}/Scripts/activate ; func pack"
},
"linux": {
"command": ". ${config:azureFunctions.pythonVenv}\\bin\\activate && func pack"
},
"isBackground": true
}
]
}

请注意windows命令的变化

关于azure - VSCode 中的 Python Azure Function (HTTPTrigger) 调试未正确启动 Func Host Start,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53677160/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com