所有依赖项(如Python 3.6),Windows环境变量均已设置,必要的require.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"
}
]
}
任何指导或帮助都值得赞赏。
答案 0 :(得分:1)
更新
自Azure Functions扩展v0.14.0起,此问题已修复。
从调试配置中删除了终端特定的分隔符
原始答案
单击settings.json
目录下的.vscode
,然后单击USER SETTINGS
。
检查设置"terminal.integrated.shell.windows"
,其值应为powershell.exe
。调试任务会根据操作系统使用不同的命令,而Windows的命令仅适用于PowerShell。
答案 1 :(得分:1)
您可以使用.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
}
]
}
通知窗口
中命令中的更改答案 2 :(得分:1)