0%

Ubuntu16.04 VSCODE 配置

anaconda,vscode下载安装(略)

通用插件安装

  • 彩色括号 Bracket Pair Colorizer

  • Code Runner

  • filesize

  • jupyter

  • latex language support

  • 主题:One Dark Pro

  • Path Intellisense

  • vscode-pdf

  • Chinese Language support

用户设置

ctrl shift p 输入 setting.json打开User设置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
// setting.json
{
//通用设置
"workbench.colorTheme": "One Dark Pro",// 主题
"workbench.iconTheme": "material-icon-theme",
"editor.fontSize": 18, // 程序字体大小
"window.zoomLevel": 0.3, // 窗体字体大小
"files.autoSave": "afterDelay", // 自动保存
"code-runner.runInTerminal": true, // 在交互终端输出而不是Output
"editor.wordWrapColumn": 79, //默认每行代码列数

//python 默认设置
"python.pythonPath": "/home/universal/anaconda3/bin/python",
}

python环境配置

  • 激活虚拟环境 conda activate machinelearning

  • 命令行进入python界面,

    1
    2
    import sys
    sys.executable #输出解释器所在目录
  • 打开 setting.json 项目配置文件

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    // setting.json 注意这里不是user的json配置文件,而是具体项目的配置文件,因为不同项目的环境会有所差别
    {
    "python.venvPath": "/home/universal/anaconda3/envs", //虚拟环境目录
    "python.pythonPath": "/home/universal/anaconda3/envs/machinelearning/bin/python", // 解释器目录
    "python.venvFolders": [
    "envs",
    ".pyenv",
    ".direnv"
    ],
    // 如果使用code-runner插件运行和调试程序,需要制定插件使用的解释器
    "code-runner.executorMap":{
    python: "/usr/bin/python3"
    },
    }
  • 当然可以在界面左下角点击python环境进行实时更换

  • 安装python合适的库

    • 机器学习

      1
      numpy, pandas, matplotlib, scikit-learn, lightgbm, scipy
    • 深度学习

      1
      keras, tensorflow, pytorch, theano

C/C++ 环境配置(Win10)

​ 需要配置四个json文件

  1. c_cpp_properties.json

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    {
    "configurations": [
    {
    "name": "Win32",
    "includePath": [
    "${workspaceFolder}/**"
    ],
    "defines": [
    "_DEBUG",
    "UNICODE",
    "_UNICODE"
    ],
    "compilerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",
    "cStandard": "c11",
    "cppStandard": "c++17",
    "intelliSenseMode": "gcc-x64"
    }
    ],
    "version": 4
    }
  2. launch.json

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    {
    // 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": "(gdb) Launch",
    "preLaunchTask": "g++.exe build active file",//调试前执行的任务,就是之前配置的tasks.json中的label字段
    "type": "cppdbg",//配置类型,只能为cppdbg
    "request": "launch",//请求配置类型,可以为launch(启动)或attach(附加)
    "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",//调试程序的路径名称
    "args": [],//调试传递参数
    "stopAtEntry": false,
    "cwd": "${workspaceFolder}",
    "environment": [],
    "externalConsole": true,//true显示外置的控制台窗口,false显示内置终端
    "MIMode": "gdb",
    "miDebuggerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\gdb.exe",
    "setupCommands": [
    {
    "description": "Enable pretty-printing for gdb",
    "text": "-enable-pretty-printing",
    "ignoreFailures": true
    }
    ]
    }
    ]
    }
  3. settings.json

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    {
    // "python.pythonPath": "C:\\ProgramData\\Anaconda3\\envs\\ML\\python.exe",
    "files.associations": {
    "thread": "cpp",
    "iostream": "cpp",
    "mutex": "cpp",
    "string": "cpp",
    "ostream": "cpp",
    "*.tcc": "cpp",
    "istream": "cpp",
    "vector": "cpp",
    "array": "cpp",
    "atomic": "cpp",
    "bitset": "cpp",
    "cctype": "cpp",
    "cfenv": "cpp",
    "charconv": "cpp",
    "chrono": "cpp",
    "cinttypes": "cpp",
    "clocale": "cpp",
    "cmath": "cpp",
    "codecvt": "cpp",
    "complex": "cpp",
    "condition_variable": "cpp",
    "csetjmp": "cpp",
    "csignal": "cpp",
    "cstdarg": "cpp",
    "cstddef": "cpp",
    "cstdint": "cpp",
    "cstdio": "cpp",
    "cstdlib": "cpp",
    "cstring": "cpp",
    "ctime": "cpp",
    "cuchar": "cpp",
    "cwchar": "cpp",
    "cwctype": "cpp",
    "deque": "cpp",
    "forward_list": "cpp",
    "list": "cpp",
    "unordered_map": "cpp",
    "unordered_set": "cpp",
    "exception": "cpp",
    "algorithm": "cpp",
    "functional": "cpp",
    "iterator": "cpp",
    "map": "cpp",
    "memory": "cpp",
    "memory_resource": "cpp",
    "numeric": "cpp",
    "optional": "cpp",
    "random": "cpp",
    "ratio": "cpp",
    "regex": "cpp",
    "set": "cpp",
    "string_view": "cpp",
    "system_error": "cpp",
    "tuple": "cpp",
    "type_traits": "cpp",
    "utility": "cpp",
    "fstream": "cpp",
    "future": "cpp",
    "initializer_list": "cpp",
    "iomanip": "cpp",
    "iosfwd": "cpp",
    "limits": "cpp",
    "new": "cpp",
    "scoped_allocator": "cpp",
    "shared_mutex": "cpp",
    "sstream": "cpp",
    "stdexcept": "cpp",
    "streambuf": "cpp",
    "typeindex": "cpp",
    "typeinfo": "cpp",
    "valarray": "cpp"
    },
    "C_Cpp.dimInactiveRegions": true,

    }
  4. tasks.json

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    {
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
    {
    "label": "g++.exe build active file",
    "type": "shell",
    "command":"C:\\Program Files\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",
    "args": [//编译时候的参数
    "-g",//添加gdb调试选项
    "-std=c++17",
    "-stdlib=libc++",
    "${file}",
    "-o",//指定生成可执行文件的名称
    "${fileDirname}\\${fileBasenameNoExtension}.exe"
    ],
    "options": {
    "cwd": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin"
    },
    "problemMatcher": [
    "$gcc"
    ],
    "group": {
    "kind": "build",
    "isDefault": true
    }
    }
    ]
    }

前端环境配置

------ 本文结束感谢您的阅读 ------