python 使用 visual studio code 環境設定

在visual studio code官網就有tutorial guide介紹
https://code.visualstudio.com/docs/python/python-tutorial

第一步是安裝python套件
1.先至左邊切到套件頁面
2.搜尋輸入python
3.按下安裝即可

套件包含內容:

A Visual Studio Code extension with rich support for the Python language (including Python 3.6), with features including the following and more:

  • Linting (Prospector, Pylint, pycodestyle, Flake8, pylama, pydocstyle, mypy with config files and plugins)
  • Intellisense (autocompletion with support for PEP 484 and PEP 526)
  • Auto indenting
  • Code formatting (autopep8, yapf, with config files)
  • Code refactoring (Rename, Extract Variable, Extract Method, Sort Imports)
  • Viewing references, code navigation, view signature
  • Excellent debugging support (remote debugging over SSH, mutliple threads, django, flask)
  • Running and debugging Unit tests (unittest, pytest, nose, with config files)
  • Execute file or code in a python terminal
  • Snippets
開啟專案目錄
Visual Studio Code通常都是以一個folder當作一個project
1.檔案總管
2.開啟資料夾
3.選擇資料夾
新建python檔案
1.建立新檔案
2.輸入檔名 .py為python副檔名

測試python開發環境

msg = "Hello World"
print(msg)


按下快速鍵  ctrl+` 開啟終端機執行視窗
直接整合在visual studio code下方
因為python免編譯所以直接輸入
輸入: python .\helloworld.py
這也支援tab鍵auto complete

如預期看到Hello World代表整個環境安裝設定成功



















留言

熱門文章