所有依赖项如Python 3.6,windows环境变量都已设置,必要的requirements.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"
}
]
}
任何方向或帮助表示赞赏。
更新
自Azure Functions扩展v0.14.0以来,它已得到修复。
从调试配置中删除了特定于终端的分隔符
原始答案
点击settings.json
目录下的.vscode
,然后点击USER SETTINGS
。
检查设置"terminal.integrated.shell.windows"
,其值应为powershell.exe
。调试任务根据操作系统使用不同的命令,Windows的命令仅适用于PowerShell。
您可以使用.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命令的更改