VS Code | Python | Pipenv
Windows 10
New Project
- Open (empty?) folder in vs code (right click directory, open with vs code)
- Terminal -> New Terminal
$ pipenv install
- Close & Open project (per step #1)
- Navigate to
.vscode
->settings.json
and note the path to the current pipenv - Edit the settings file to match:
{ "python.venvPath": "C:/Users/[username]/.virtualenvs", "python.pythonPath": "C:/Users/[username]/.virtualenvs/[pipenv_path]/Scripts/python.exe" "code-runner.executorMap": { "python": "$pythonPath $fullFileName", } "code-runner.runInTerminal": true }
Note: The default path automatically generated by vs code for the settings.json file will likely have double back slashes. This does not work well with the code runner extension for some reason. Make sure to change the double back slashes to single forward slashes.
- Close & Open project (per step #1)
- Terminal -> New Terminal
$ pipenv install [package(s)]
- Right click ->
Run Code
(orRun Python File in Terminal
depending on what extensions you have installed)