1.安装npm与node。在cmd中使用这两个命令验证是否安装
C:\Users\z>node --version
v24.18.0
C:\Users\z>npm --version
11.16.0
2.安装claude code
2.1在cmd中使用这个命令
C:\Users\z>npm install -g @anthropic-ai/claude-code
一般返回一下内容:
added 2 packages in 17s npm warn allow-scripts 1 package has install scripts not yet covered by allowScripts: npm warn allow-scripts @anthropic-ai/claude-code@2.1.220 (postinstall: node install.cjs) npm warn allow-scripts npm warn allow-scripts Run `npm approve-scripts --allow-scripts-pending` to review, or `npm approve-scripts <pkg>` to allow.
2.2现在使用C:\Users\z>claude --version
'claude' is not recognized as an internal or external command, operable program or batch file.
2.3 将claude.cmd目录添加到path环境变量中
使用下面的命令
C:\Users\z>npm prefix -g
将输出的内容添加到环境变量中。
C:\Users\z>claude --version
2.1.220 (Claude Code)
3.将deepseek的api添加到claude的配置中
3.1在 Windows 系统中,路径为:C:\Users\你的用户名\.claude\
在该文件夹下找到或新建settings.json文件。
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.deepseek.com/anthropic",
"ANTHROPIC_AUTH_TOKEN": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"ANTHROPIC_MODEL": "deepseek-v4-flash"
}
}
填入以上内容,ANTHROPIC_AUTH_TOKEN为deepseek的API。
3.2验证
C:\Users\z>claude
Welcome to Claude Code v2.1.220
..........................................................
* █████▓▓░
* ███▓░ ░░
░░░░░░ ███▓░
░░░ ░░░░░░░░░░ ███▓░
░░░░░░░░░░░░░░░░░░░ * ██▓░░ ▓
╭─── Claude Code v2.1.220 ────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │ Tips for getting started │
│ Welcome back! │ Run /init to create a CLAUDE.md file with instructions for Claude │
│ │ Note: You have launched claude in your home directory. For the best experi… │
│ ▐▛███▜▌ │ ───────────────────────────────────────────────────────────
> hi
Thought for 3s (ctrl+o to expand)
● Hi! How can I help you today? If you're working on something, let me know what you'd like to do — whether it's coding,
debugging, researching, or anything else.