← 返回首页ai798Lab 公开知识库

Vibe Coding 课程-干货集训

02 如何安装&配置Claude Code

2025年12月18日

Claude Code在哪使用

插件(首推)

  1. 在编程工具中使用Claude Code插件

    Claude Code for Cursor

    Claude Code for VSCode

  2. 新手推荐指数
    1. 🌟🌟🌟🌟🌟
  3. 优势
  4. 劣势

CLI

  1. 在电脑本地终端使用Claude Code
  2. 新手推荐指数
    1. 🌟🌟🌟🌟
  3. 优势
  4. 劣势

Web

  1. 在浏览器使用Claude Code
    1. 传送门:https://claude.ai/code
  2. 新手推荐指数
    1. 🌟🌟🌟
  3. 优势
  4. 劣势

安装Claude Code插件(以Cursor为例)

Step 1 · 下载Cursor

  1. 下载并安装
    1. Cursor:https://cursor.com/
    2. VScode(Visual Studio Code):https://code.visualstudio.com/download

Step 2 · 下载Claude Code插件

  1. 打开Cursor,进入「插件」面板,搜索“Claude Code”并下载

Step 3 · 登录Claude Code

  1. 安装完成后,点击"..." - 「」
  2. 进入Claude Code对话页面
  3. 点击「Claude.ai Subscription」,打开网页进行授权
  4. 授权成功,回到Cursor就能开始使用Claude Code了

安装Claude Code CLI

MacOS

Step 1 · 安装Node.js

  1. 打开终端:Command + 空格 ➡️ 输入“Terminal”(即终端) ➡️ 打开终端
  2. 在终端里输入指令,检测是否安装Node.js
    node -v
    1. 已安装Node.js,会出现
    2. 未安装Node.js,先前往官网下载
      1. 下载地址:https://nodejs.org
      1. 下载并安装成功后,打开终端,输入命令,验证安装成功
      node -v    # 应该显示 v20.x.x 或 v22.x.x    
      npm -v     # 应该显示 10.x.x

Step 2 · 安装Claude Code

  1. 在终端输入以下命令
    npm install -g @anthropic-ai/claude-code
    1. 如果你的网络很慢,关掉vpn,在终端内先用键盘的“Control + C”停掉进程,再输入以下指令,使用国内镜像安装
    npm install -g @anthropic-ai/claude-code --registry=https://registry.npmmirror.com
  2. 如果安装成功,会出现这样的结果
    changed 16 packages in 4s
    
    2 packages are looking for funding
      run `npm fund` for details

Step 3 · 登录Claude Code

  1. 验证当前安装是否成功,在终端输入指令,看到版本号就说明安装成功
    claude --version
  2. 确定安装成功后,输入指令
    claude
    1. 应该可以看到,Claude让你做授权的选项,点击回车键
    2. 我们就能看到,启动Claude Code CLI成功的画面。即可开始使用

Windows

Step 1 · 确认系统自带Powershell

  1. Windows 10(版本1903及以上)自带Powershell,更早的系统版本请先更新Windows系统

Step 2 · 打开Powershell

  1. 右键点击开始菜单 → 选择"Windows PowerShell"

Step 3 · 使用winget方式安装Node.js

  1. 输入指令
    winget install OpenJS.NodeJS.LTS
  2. 出现如下结果
    Found Node.js LTS [OpenJS.NodeJS.LTS] Version x.x.x 
    Starting package install... 
    Successfully installed
  3. 验证Node.js安装结果,输入指令
    node -v
    ```
    
    **预期结果**
    ```
    v20.x.x 或 v22.x.x

Step 4 · 安装Claude Code

  1. 在Powershell中输入指令
    npm install -g @anthropic-ai/claude-code
    1. 如果速度很慢,请使用国内镜像
    npm install -g @anthropic-ai/claude-code --registry=https://registry.npmmirror.com
    ```
    
    **预期结果**
    ```
    added 16 packages in 4s
  2. 安装成功后,验证一下,在Powershell中输入
    claude --version
    ```
    
    **预期结果**
    ```
    claude version x.x.x(如 1.0.40)

Step5 · 启动Claude Code

  1. 在Powershell中输入指令
    claude 
    ```  
    
    **预期结果** 
    ``` 
    
    终端显示: 
    To authenticate, visit: https://console.anthropic.com/...
    1. 打开对应页面进行授权即可
    2. 完成授权后,回到Powershell,如果显示如下👇,则启动成功。即可开始使用
    Successfully authenticated as: xxx@xxx.com