0.环境配置

0.环境配置

明廷盛 嘻嘻😁

1.node环境配置

什么是nvm? 见下表格的对比

node python
不同版本 nvm目录下的不同文件夹 conda的env目录下的不同文件夹
下载器 npm(所有版本共享) pip(一个版本一个下载器)
nvm🆚conda nvm管理node的不同版本 conda关闭pytho的不同版本
  • 下载exe那个, 然后安装, 下一步, 下一步即可; 【验证: nvm -v有版本号就✅️】
  • 后续找不到? cmd→where nvm→就是nvm的路径

STEP2: 下载node

指令 注意
①查看可以用的node版本 nvm list available
②下载指定版本node nvm install 25.0.0 下载”current”那一列的
③使用对应版本的node nvm use 25.0.0 切换后, 任意cmd窗口的node都会换为这个版本
④查看所有已下载的版本 nvm ls

STEP3: 手动创建global和cache 和 module的新环境变量

不配的化, npm -g下载的东西无法直接调用

  1. 在nvm的 同级 下创建”node_global”和”node_cache”两个文件夹
  2. cmd中输入
设置
npm config set prefix C:\Users\15943\AppData\Local\nvm\node_global
npm config set cache node_cache的绝对路径

查看
npm config get prefix
npm config get cache
  1. 系统环境变量, 把node_global的绝对路径 加到环境变量中
  2. 系统环境变量, 新建变量名: NODE_PATH 值:C:\Users\15943\AppData\Local\nvm\node_global\node_modules 【无需手动建,凭空多一个node_modules】

STEP4: npm配置淘宝镜像

配置镜像
npm config set registry https://registry.npmmirror.com

查看镜像
npm config get registry

换位npm源镜像
npm config set registry https://registry.npmjs.org

2.VS Code配置C/C++环境

STEP1: MinGW-w64

下载MinGW-w64 link (下方 releases)图一

  • i686:表示 32 位的 x86 架构。适用于较旧的 32 位操作系统或者需要兼容 32 位环境的场景。
  • x86_64:表示 64 位的 x86 架构。适用于 64 位操作系统,能充分利用 64 位系统的内存寻址和计算能力。
  • mcf:Multithreaded with Coroutine and Fiber Support,支持协程和纤程的多线程模型,这种模型可能在处理异步和并发任务时提供更灵活的方式。
  • posix:遵循 POSIX(Portable Operating System Interface)标准的线程模型,提供了一套统一的线程操作接口,使得代码在不同的 POSIX 兼容系统上具有更好的可移植性。常用于跨平台开发。
  • win32:基于 Windows 32 位线程 API 的线程模型,专门针对 Windows 操作系统进行优化,在 Windows 平台上能更好地与系统的线程机制集成。
图一
image.png|675
图二
image.png|500

STEP2: 配置环境变量

下载好后, 移动到一个地方, 然后配置/bin的环境变量(图二)

STEP3: 下载VS Code插件

如图三所示

图三
图四
image.png

STEP4: 配置VS Code

创建.vscode文件夹, 并创建如下四个json配置文件(图四)

有1处路径需要改为你自己的
here注释的地方改为你的XXX路径; (直接cmd打开where gcc把路径复制过去, 注意多一个斜杠! 下同)

{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.22621.0",
"compilerPath": "C:\\Users\\xi\\mingw64\\bin\\gcc.exe", //here 改你自己的路径
"cStandard": "c99",
"cppStandard": "c++11",
"intelliSenseMode": "windows-gcc-x64"
}
],
"version": 4
}

有2处路径需要改为你自己的

{
"configurations": [
{
"name": "C调试",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/output.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "C:\\Users\\xi\\mingw64\\bin\\gdb.exe", //here1 改你自己的路径
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "gcc"
},
{
"name": "C++调试",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/output.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": true, // 是否打开新窗口进行调试
"MIMode": "gdb",
"miDebuggerPath": "C:\\Users\\xi\\mingw64\\bin\\gdb.exe", //here2 改你自己的路径
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "g++"
}
],
"version": "2.0.0"
}

有5处路径需要改为你自己的

{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild", //
"label": "gcc", // C运行
"command": "C:\\Users\\xi\\mingw64\\bin\\gcc.exe", //here1 改你自己的路径
"args": [
"-fdiagnostics-color=always",
"-g",
// "${file}",
"${fileDirname}\\*.c",
"-o",
"output.exe"
],
"detail": "compiler: C:\\Users\\xi\\mingw64\\bin\\gcc.exe", //here2 改你自己的路径
"options": {
"cwd": "${fileDirname}",
"shell": true
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
},
{
"type": "cppbuild",
"label": "g++", // C++运行
"command": "C:\\Users\\xi\\mingw64\\bin\\g++.exe", //here3 改你自己的路径
"args": [
"-fdiagnostics-color=always",
"-g",
// "${file}",
"${fileDirname}\\*.cpp",
"-std=c++11", // 添加C++标准参数
"-o",
"output.exe"
],
"detail": "compiler: C:\\Users\\xi\\mingw64\\bin\\g++.exe",
"options": {
"cwd": "${fileDirname}",
"shell": true
},
"problemMatcher": [ // 错误输出
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
},
{
"type": "shell",
"label": "gcc-utf8",
"command": "chcp 65001 && C:\\Users\\xi\\mingw64\\bin\\gcc.exe", //here4 改你自己的路径
"args": [
"-fdiagnostics-color=always",
"-g",
"*.c",
"-o",
"output.exe"
],
"options": {
"cwd": "${fileDirname}",
"shell": true
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"label": "g++-utf8",
"command": "chcp 65001 && C:\\Users\\xi\\mingw64\\bin\\g++.exe",//here5 改你自己的路径
"args": [
"-fdiagnostics-color=always",
"-g",
"*.cpp",
"-std=c++11",
"-o",
"output.exe"
],
"options": {
"cwd": "${fileDirname}",
"shell": true
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": false
}
}
]
}

注意⚠️: 运行单个文件

image.png

{
// 格式化时的格式配置
"C_Cpp.clang_format_style": "{BasedOnStyle: LLVM, BreakBeforeBraces: Attach, AlignTrailingComments: true, ReflowComments: true, SpacesBeforeTrailingComments: 2, IndentWidth: 4, TabWidth: 4, UseTab: Never, ColumnLimit: 250, AllowShortIfStatementsOnASingleLine: false, AllowShortBlocksOnASingleLine: Never, AllowShortLoopsOnASingleLine: false, AllowShortCaseLabelsOnASingleLine: false, AllowShortFunctionsOnASingleLine: None, IndentCaseLabels: true, PointerAlignment: Right}",
"C_Cpp.clang_format_fallbackStyle": "LLVM",
"editor.formatOnSave": true, // 保存时自动格式化
"editor.defaultFormatter": "ms-vscode.cpptools",
// 使用C/C++扩展的格式化工具
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
// 配置多文件运行
"code-runner.executorMap": {
// 单个文件
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
// 多个文件
// "c": "chcp 65001 && cd $dirWithoutTrailingSlash && gcc *.c -o output && .\\output.exe",
// "cpp": "chcp 65001 && cd $dirWithoutTrailingSlash && g++ *.cpp -o output && .\\output.exe"
},
"files.associations": {
"header.h": "c",
"generallist.h": "c",
"random": "c",
"bit": "cpp",
"compare": "cpp",
"concepts": "cpp",
"type_traits": "cpp",
"cmath": "cpp",
"limits": "cpp",
"new": "cpp",
"array": "c",
"string": "c",
"string_view": "c",
"span": "c",
"polynomial.h": "c",
"time.h": "c",
"assert.h": "c",
"cctype": "cpp",
"exception": "cpp",
"format": "cpp",
"stack": "cpp",
"variant": "cpp",
"linear.h": "c"
},
"C_Cpp.errorSquiggles": "enabled",
"code-runner.terminalRoot": "",
"code-runner.runInTerminal": true,
"code-runner.saveFileBeforeRun": true
}

3.图床配置(PicList&&Obsidian)

前置条件: ①需要Node.js和Git环境 ②PicList是PicGo的升级版本

下一步, 下一步, 下一步!

STEP2: PicList配置

1. PicList中下载插件
image.png|500
2.图床→Amazon S3
cd804fc7ad61d5453ee93d2bd7922660.png|400
  • 注意: 建议把PicList的快捷键关了, 和VS Code的命令行快捷键重合了(CommandOrControl+Alt+P)

STEP3: Obsidian下载插件(image auto upload)

默认无需配置, 下载即用

  • Title: 0.环境配置
  • Author: 明廷盛
  • Created at : 2026-02-02 05:32:25
  • Updated at : 2026-01-08 13:23:00
  • Link: https://blog.20040424.xyz/2026/02/02/😼Java全栈工程师/0.环境配置/
  • License: All Rights Reserved © 明廷盛