开发环境配置
本文是速查手册,只列安装命令和关键配置,默认你已有基础使用经验。
Winget 安装(Windows 必装)
Winget 是 Windows 官方的命令行包管理器,Windows 10 1809 及以上的系统一般自带。
打开 PowerShell 或终端,检查安装:
powershellwinget --version
有输出即为安装成功;没有则在 Microsoft Store 搜索「应用安装程序(App Installer)」安装。
Git
安装
Windows
winget install --id Git.Git -eArch Linux
sudo pacman -S git配置信息
设置用户名,建议与 GitHub 用户名一致:
bashgit config --global user.name "[用户名]"设置邮箱,建议与 GitHub 邮箱一致:
bashgit config --global user.email "[邮箱]"设置默认分支为
main:bashgit config --global init.defaultBranch main配置全局代理(可选):
bashgit config --global http.proxy "http://127.0.0.1:30000" git config --global https.proxy "http://127.0.0.1:30000"
C/C++
安装
Windows
winget install --id BrechtSanders.WinLibs.MCF.UCRT -eArch Linux
sudo pacman -S base-devel与 VS Code 集成
不使用 VS Code 官方 C/C++ 扩展,推荐使用 Clangd(更强的静态分析)。
安装 VS Code
安装扩展:
clangd、Code Runner安装 Clangd 本体
- Windowspowershell
winget install --id LLVM.LLVM -e - Arch Linuxbash
sudo pacman -S clangd
开启
code-runner的runInTerminal设置修改
executorMap中cpp配置:cd $dir && g++ $fileName -std=c++14 -O2 -o $fileNameWithoutExt && $dir$fileNameWithoutExt点击 cpp 文件右上角的
Run Code按钮运行
检查安装
gcc --version有输出即为安装成功
Python
使用 uv 作为包管理器(比官方 pip 更快、更易管理)
安装
Windows
winget install --id astral-sh.uv -e
uv python installArch Linux
sudo pacman -S uv配置 uv 镜像源
Windows
mkdir -p $env:APPDATA\uv
echo @"
[[index]]
url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
default = true
"@ > $env:APPDATA\uv\uv.tomlArch Linux
mkdir -p ~/.config/uv && printf '[[index]]\nurl = "https://pypi.tuna.tsinghua.edu.cn/simple/"\ndefault = true\n' > ~/.config/uv/uv.toml与 VS Code 集成
安装 VS Code
安装扩展:
python、Code Runner开启
code-runner的runInTerminal设置命令面板 →
Python:选择解释器→ 选择 uv 安装的 Python 解释器点击 py 文件右上角的
Run Code按钮运行
检查安装
python --version
uv --version有输出即为安装成功
Rust
安装
Windows
winget install --id Rustlang.Rustup -eArch Linux
sudo pacman -S rust配置 Cargo 镜像
Windows
mkdir -p ~/.cargo
echo @"
[source.crates-io]
replace-with = "mirror"
[source.mirror]
registry = "sparse+https://mirrors.aliyun.com/crates.io-index/"
"@ > ~/.cargo/config.tomlArch Linux
mkdir -p ~/.cargo && echo -e '[source.crates-io]\nreplace-with = "mirror"\n[source.mirror]\nregistry = "sparse+https://mirrors.aliyun.com/crates.io-index/"' > ~/.cargo/config.toml与 VS Code 集成
安装 VS Code
安装扩展:
rust-analyzer、Code Runner开启
code-runner的runInTerminal设置点击 rs 文件右上角的
Run Code按钮运行
检查安装
rustc --version
cargo --version有输出即为安装成功
Node.js
安装
Windows
winget install --id OpenJS.NodeJS -e
npm install -g pnpmArch Linux
sudo pacman -S nodejs npm pnpm配置镜像源
npm config set registry https://registry.npmmirror.com
pnpm config set registry https://registry.npmmirror.com检查安装
node --version
npm --version
pnpm --version有输出即为安装成功
Go
安装
Windows
winget install --id GoLang.Go -eArch Linux
sudo pacman -S go配置镜像源
Windows
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,directArch Linux
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct检查安装
go version有输出即为安装成功
Java
安装
Windows
winget install --id Azul.Zulu.25.JDK -eArch Linux
paru -S zulu-25-bin配置环境变量
Windows
在 PowerShell 中运行以下命令(默认安装目录为 C:\Program Files\Zulu\zulu-25,如有出入请以实际目录为准):
[Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\Program Files\Zulu\zulu-25", "User")
$path = [Environment]::GetEnvironmentVariable("Path", "User")
[Environment]::SetEnvironmentVariable("Path", "$path;C:\Program Files\Zulu\zulu-25\bin", "User")检查安装
java --version
javac --version有输出即为安装成功
Kotlin
Windows
Kotlin 依赖 JDK,请先完成上面的 Java 安装。
winget install --id Kotlin.Kotlin -eArch Linux
sudo pacman -S kotlin检查安装
kotlin -version有输出即为安装成功