# Visual Studio Code 設置環境
###### tags: `python`
[TOC]
## 一. 在延伸模組中搜尋並安裝

## 二. 設定工作執行器
1. 新建一個資料夾(ex. Python)
2. 新增檔案
3. 當中新建一個子資料夾 **.vscode**

4. 新增以下兩個檔案

* launch.json
```
{
// 使用 IntelliSense 以得知可用的屬性。
// 暫留以檢視現有屬性的描述。
// 如需詳細資訊,請瀏覽: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
```
* settings.json
```
{
"python.pythonPath": "c:\\Python3.7\\python.exe", //Python3.7的路徑
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"files.trimTrailingWhitespace": true, // 儲存的時候,會幫你自動過濾多餘的空格
"files.autoSave": "onFocusChange", // 是否自動儲存檔案
"[python]":{ //自行設定
"editor.formatOnType": true,
"editor.formatOnSave": true,
"editor.renderIndentGuides": true,
"editor.insertSpaces": true,
"editor.detectIndentation": true,
"editor.tabSize": 4
},
"python.formatting.provider": "yapf",
}
```
## 三.測試是否能執行
1. 新增一個 .py檔案(hello.py)

```
msg = "Hello World ! "
print(msg)
```
2. 在終端機執行

