[tool] Visual Studio Code python配置

语言设置

安装中文插件即可成为中文

 

选择一个Python解释器

Python是一种解释型语言,为了运行Python代码并获取Python IntelliSense,您必须告诉VS Code使用哪个解释器。

在VS Code中,通过打开命令选项板Ctrl + Shift + P选择Python 3解释器

输入 Python: Select Interpreter

 选择你的解释器

 

创建一个Python Hello World源代码文件

从文件资源管理器工具栏中,单击文件hello上的“新建文件”按钮

命名该文件hello.py,它将自动在编辑器中打开:

运行Hello World

hello.p y使用Python 运行很简单在编辑器中单击鼠标右键,然后选择“在终端中运行Python文件”(自动保存文件):

 

该命令打开一个终端面板,在其中自动激活Python解释器,然后运行python3 hello.py(macOS / Linux)或python hello.py(Windows):

在VS Code中可以运行Python的另外两种方法:

  • 选择一行或多行,然后按Shift + Enter或右键单击并选择在Python终端中运行选择/行。此命令非常便于测试文件的一部分。
  • 使用Python:Start REPL命令打开当前所选Python解释器的REPL终端。然后,在REPL中,您可以一次输入和运行一行代码。 
  •  

上述所有使用教程都可以在以下官方tutorial找到

 https://code.visualstudio.com/docs/languages/python

自用插件列表

python preview可以充当spyder用 右键py文件标签 选择预览该文件

能够看到具体的数据结构 

settings.json 配置 (装了One Dark Pro)

{
    "python.pythonPath": "D:\\python\\python.exe",
    "workbench.colorTheme": "One Dark Pro Bold",
    "editor.fontSize": 14, 
    "editor.lineHeight": 20,
    "editor.tokenColorCustomizations": {
            "textMateRules": [
            {
                "name": "Comments",
                "scope": "comment, punctuation.definition.comment",
                "settings": {
                "fontStyle": ""
                }
            },
            {
                "name": "js/ts italic",
                "scope": "entity.other.attribute-name.js,entity.other.attribute-name.ts,entity.other.attribute-name.jsx,entity.other.attribute-name.tsx,variable.parameter,variable.language.super",
                "settings": {
                "fontStyle": ""
                }
            },
            {
                "name": "js ts this",
                "scope": "var.this,variable.language.this.js,variable.language.this.ts,variable.language.this.jsx,variable.language.this.tsx",
                "settings": {
                "fontStyle": ""
                }
            }
            ]
        },
        "explorer.confirmDelete": false
}

 

posted @ 2018-10-16 20:41  clemente  阅读(6060)  评论(1编辑  收藏  举报