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