'vscode isn't starting pipenv properly
I'm trying to get vscode to use my pipenv environment. When I run my code from inside a pipenv shell it works fine. When vscode runs it fails to find any of my packages. Below is the vscode Terminal output. If I run this on a command line I get the same problems as vscode - so at least that's consistent.
The pipenv path below is correct but the invocation is wrong. What do I need to fix in my configuration?
/usr/bin/env
/home/user/.local/share/virtualenvs/workflowy_2_obsidian-12Fbw0_6/bin/python
/home/user/.vscode/extensions/ms-python.python-2022.4.1/pythonFiles/lib/python/debugpy/launcher
40349 -- /home/user/workflowy_2_obsidian/wkfly2obsidian.py
.vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
}
]
}
Solution 1:[1]
Add the following code into your setting.json:
"python.venvPath": ".../virtualenvs" #your pipenv's path
Then restart vscode, "CTRL+SHIFT+P" and choose the correct python interpreter.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | MingJie-MSFT |

