VSCODE pipenvの環境からデバッグを実行したいときには
.vscode/settings.jsonにpythonPathの項目を追加する。
{
"python.autoComplete.extraPaths": [
"/Users/chiaki/.local/share/virtualenvs/cognito_sample-4m7Vb3k3/lib/python3.9/site-packages/",
],
"python.pythonPath": "/Users/chiaki/.local/share/virtualenvs/cognito_sample-4m7Vb3k3/bin/python"
}
pythonPathの値は、仮想環境に入ったあとのpythonパスを参照すること。
手順;
# `仮想環境に入る` pipenv shell # which python
settings.jsonにpythonPathを追加すると仮想環境に入っていなくてもデバッグを起動すると仮想環境でデバッグが実行される。