---
title: 'Visual Studio Code for Python project(poetry and pipenv)'
disqus: diabee
---
# Visual Studio Code for some projects (springboot poetry and pipenv)
[TOC]
## Visual Studio Code 相關debugger 設定介面和操作
> Extention

> Run and Debug

## Pyenv 安裝
可以參考之前[文章](https://hackmd.io/@Diabee/pyenv-install)
## Pipenv for flask
> Run and Debug > create a launch.json file > select Python Debugger > select Flask > select app_main.py
>
>
>
vscode => launch.json
```json=1
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Flask",
"type": "debugpy",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "app_main.py",
"FLASK_DEBUG": "1"
},
"args": [
"run",
"--no-debugger",
"--no-reload"
],
"jinja": true,
"autoStartBrowser": false
}
]
}
```
## 選對 Python Interpreter(重要)
打開 Command Palette (Ctrl+Shift+P)
輸入 Python: Select Interpreter
---
>F5 > debuggger

## Poetry for fastapi
vscode => launch.json
```json=1
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: FastAPI",
"type": "debugpy",
"request": "launch",
"module": "uvicorn",
"args": [
"src.main:app",
"--reload"
],
"jinja": true
}
]
}
```
>其他跟前一個主題的操作很類似
## VSCode for Springboot project
>
## 問題發生處理
> 如果有咬死版本,且讓你無法切換python版本,可以下deactivate指令,重新pyenv local 版本 和 pipenv install(shell)切換
或著[參考文章後面的問題](https://hackmd.io/@Diabee/pyenv-install)