Claude Code 一键安装工具:小白也能轻松上手
一个一键安装脚本,自动搞定 Node.js、Git、Claude Code、CC Switch 的安装和 API 配置,3 分钟开箱即用。
这个工具能做什么
一键安装以下内容:
- Node.js — Claude Code 运行的基础环境
- Git — 版本管理工具,Claude 环境也需要
- Claude Code CLI — Claude 的命令行工具
- CC Switch — AI 服务商切换工具,支持 50+ 服务商
- API 配置 — 自动写入配置文件,开箱即用
整个过程大约 3-5 分钟,只需要填两个空:API 地址和 Key。
使用方法
第一步:下载安装包
下载 安装ClaudeCode.exe(文章底部也有下载地址)
第二步:右键以管理员身份运行
双击会闪退,记得右键选择"以管理员身份运行"。
第三步:按提示操作
脚本会自动检测并安装缺少的组件,你只需要:
- 选择 API 请求地址(默认使用 xiaomimimo 按量计费接口)
- 粘贴你的 API Key
其他全自动,等着就行。
第四步:安装完成
安装完成后,桌面会生成一个 ClaudeCode使用教程.url,双击可以查看使用教程。
API 服务商选择
脚本提供三个选项:
| 选项 | 地址 | 说明 |
|---|---|---|
| 1(默认) | https://api.xiaomimimo.com/anthropic | xiaomimimo 按量计费 |
| 2 | https://token-plan-cn.xiaomimimo.com/anthropic | xiaomimimo Plan 订阅套餐 |
| 3 | 手动输入 | 使用其他服务商 |
如果你用的是其他服务商(比如 DeepSeek、OpenRouter 等),选择第 3 项,手动输入对应的 API 地址即可。
安装后怎么用
可以见这篇文章:https://vue2.xyz/p/ccte
启动 Claude Code
- 按
Win+R,输入cmd,回车 - 输入
claude - 开始对话
简单示例
帮我写一封请假邮件
翻译这段话成英文
总结一下这篇文章的要点
常用命令
| 命令 | 说明 |
|---|---|
/help |
查看帮助 |
/clear |
清空对话 |
/exit |
退出 |
/skills |
查看已安装技能 |
常见问题
Q: 双击 exe 后闪退怎么办?
A: 右键选择"以管理员身份运行",不要直接双击。
Q: 安装过程中报错怎么办?
A: 确保网络连接正常,如果 npm 安装失败,脚本会自动切换国内镜像重试。
Q: 提示 API Key 无效?
A: 检查 C:\Users\你的用户名\.claude\settings.json 文件,确认地址和 Key 是否正确。
Q: 安装后在 cmd 里输入 claude 没反应?
A: 关闭 cmd 重新打开,或者重启电脑。
Q: 怎么切换不同的 AI 服务商?
A: 安装了 CC Switch 后,在系统托盘找到图标,点击即可切换,无需重启 Claude Code。
进阶:CC Switch 使用
CC Switch 是一个可视化配置管理工具,支持 50+ AI 服务商预设。
主要功能:
- 一键导入供应商配置
- 系统托盘即时切换
- 统一管理 MCP 和 Skills
- 基于 SQLite 数据库,配置不丢失
在系统托盘找到 CC Switch 图标,点击选择要使用的服务商即可。
下载地址
文件大小约 10MB,无需安装 Python 或其他依赖,开箱即用。
写在最后
这个工具的初衷是让不懂技术的朋友也能用上 Claude Code,不用被繁琐的安装步骤劝退。
如果你在使用过程中遇到问题,欢迎在评论区留言,或者查看 Claude Code 使用教程。
如果觉得有用,欢迎分享给更多人。
附上工具脚本源码:
# -*- coding: utf-8 -*-
import subprocess
import os
import sys
import json
import ctypes
def is_admin():
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except:
return False
def run_cmd(cmd, check=True):
result = subprocess.run(cmd, shell=True, capture_output=True, text=True, encoding='gbk', errors='replace')
if check and result.returncode != 0:
return None, result.stderr
return result.stdout.strip(), None
def refresh_path():
result = subprocess.run(
['powershell', '-Command',
'[System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")'],
capture_output=True, text=True
)
os.environ["Path"] = result.stdout.strip()
def check_cmd(name):
result = subprocess.run(f"where {name}", shell=True, capture_output=True)
return result.returncode == 0
def install_winget(package, name):
print(f"\n 正在安装 {name}...(可能需要 1-2 分钟)", flush=True)
out, err = run_cmd(f"winget install {package} --accept-source-agreements --accept-package-agreements")
if err:
print(f" 安装失败: {err}")
return False
print(f" {name} 安装成功")
return True
def main():
if not is_admin():
print("请右键选择'以管理员身份运行'此程序!")
input("按回车退出...")
sys.exit(1)
print("=" * 50)
print(" Claude Code CLI 一键安装脚本")
print("=" * 50)
print()
print(" 温馨提示:")
print(" - 安装过程中请不要点击此窗口,否则可能会暂停")
print(" - 如果不小心点到了,在窗口内 右键一下 就能继续")
print(" - 需要粘贴时,点击黑窗口边框,然后用 Ctrl+V 组合键")
print(" - 整个过程大约 3-5 分钟,喝杯水的时间就好")
# 1. Node.js
print()
print("[1/5] 检查 Node.js")
print(" Node.js 是 Claude Code 运行的基础环境")
if check_cmd("node"):
version = run_cmd("node -v")[0]
print(f" 已安装 {version},跳过此步")
else:
print(" 正在检查...")
if not install_winget("OpenJS.NodeJS.LTS", "Node.js"):
input(" 按回车退出...")
sys.exit(1)
refresh_path()
if not check_cmd("node"):
print(" 安装后检测失败,请重启电脑后重试")
input(" 按回车退出...")
sys.exit(1)
# 2. Git
print()
print("[2/5] 检查 Git")
print(" Git 用于 Claude 环境需要,自己也可以用来作文件版本管理")
if check_cmd("git"):
print(" 已安装,跳过此步")
else:
print(" 正在检查...")
if not install_winget("Git.Git", "Git"):
input(" 按回车退出...")
sys.exit(1)
refresh_path()
if not check_cmd("git"):
print(" 安装后检测失败,请重启电脑后重试")
input(" 按回车退出...")
sys.exit(1)
# 3. Claude Code CLI
print()
print("[3/5] 安装 Claude Code CLI")
print(" 这是 Claude 的命令行工具")
if check_cmd("claude"):
print(" 已安装,跳过此步")
else:
print(" 正在安装...(可能需要 1-2 分钟)", flush=True)
out, err = run_cmd("npm install -g @anthropic-ai/claude-code")
if err:
print(" 切换国内镜像重试...")
run_cmd("npm config set registry https://registry.npmmirror.com")
out, err = run_cmd("npm install -g @anthropic-ai/claude-code")
if err:
print(f" 安装失败: {err}")
input(" 按回车退出...")
sys.exit(1)
print(" Claude Code CLI 安装成功")
# 4. CC Switch
print()
print("[4/5] 安装 CC Switch")
print(" CC Switch 可以帮你轻松切换不同的 AI 服务商")
if check_cmd("ccswitch"):
print(" 已安装,跳过此步")
else:
print(" 正在安装...(可能需要 1-2 分钟)", flush=True)
if not install_winget("farion1231.CC-Switch", "CC Switch"):
print(" CC Switch 安装失败,可稍后手动安装")
else:
print(" CC Switch 安装成功")
# 5. 配置 API
print()
print("[5/5] 配置 AI 服务商")
print(f" 配置文件位置: C:\\Users\\你的用户名\\.claude\\settings.json")
print()
print(" 请选择 API 请求地址:")
print(" 1. https://api.xiaomimimo.com/anthropic (xiaomimimo 按量计费,默认)")
print(" 2. https://token-plan-cn.xiaomimimo.com/anthropic (xiaomimimo Plan订阅套餐)")
print(" 3. 手动输入其他服务商地址")
print()
choice = input(" 选择 (1/2/3,直接回车默认1): ").strip()
if choice == "2":
endpoint = "https://token-plan-cn.xiaomimimo.com/anthropic"
elif choice == "3":
endpoint = input(" 请输入 API 请求地址: ").strip()
else:
endpoint = "https://api.xiaomimimo.com/anthropic"
print(f" 已选择: {endpoint}")
print()
print(" 请点击黑窗口边框,然后用 Ctrl+V 粘贴 API Key")
api_key = input(" API Key: ").strip()
if not endpoint or not api_key:
print(" 地址或Key为空,跳过配置")
else:
config_dir = os.path.join(os.environ["USERPROFILE"], ".claude")
os.makedirs(config_dir, exist_ok=True)
config = {
"env": {
"ANTHROPIC_AUTH_TOKEN": api_key,
"ANTHROPIC_BASE_URL": endpoint,
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "mimo-v2.5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME": "mimo-v2.5",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "mimo-v2.5[1M]",
"ANTHROPIC_DEFAULT_OPUS_MODEL_NAME": "mimo-v2.5[1M]",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "mimo-v2.5-pro[1M]",
"ANTHROPIC_DEFAULT_SONNET_MODEL_NAME": "mimo-v2.5-pro[1M]",
"ANTHROPIC_MODEL": "mimo-v2.5"
},
"autoMemoryEnabled": True,
"includeCoAuthoredBy": False,
"model": "sonnet",
"permissions": {
"allow": [
"Bash(where claude *)",
"Bash(npm *)",
"Bash(git *)",
"Bash(ls *)",
"Bash(dir *)",
"Bash(cat *)",
"Bash(node *)",
"Bash(echo *)",
"Bash(which *)",
"Bash(reg query *)"
]
},
"theme": "dark"
}
config_path = os.path.join(config_dir, "settings.json")
with open(config_path, "w", encoding="utf-8") as f:
json.dump(config, f, indent=2, ensure_ascii=False)
print(" 配置完成")
# 6. 写入教程链接到桌面
desktop = os.path.join(os.environ["USERPROFILE"], "Desktop")
tutorial_path = os.path.join(desktop, "ClaudeCode使用教程.url")
with open(tutorial_path, "w", encoding="utf-8") as f:
f.write("[InternetShortcut]\n")
f.write("URL=https://vue2.xyz/p/ccte\n")
print()
print(" 已在桌面生成教程快捷方式: ClaudeCode使用教程.url")
print()
print("=" * 50)
print(" 安装完成!")
print("=" * 50)
print()
print(" 已安装以下内容:")
print(" - Node.js")
print(" - Git")
print(" - Claude Code CLI")
print(" - CC Switch")
print(" - AI 服务商配置")
print()
print(" 下一步:")
print(" 1. 打开终端(Win+R 输入 cmd)")
print(" 2. 输入: claude")
print(" 3. 即可开始使用")
input("\n 按回车退出...")
if __name__ == "__main__":
main()
评论
暂无评论,来写第一条吧
