Claude Code - 安装,配置
安装方式¶
方式一:脚本安装(需要良好的网络环境)¶
Mac / Linux:
Windows PowerShell:
方式二:直接下载二进制文件(推荐)¶
下载地址:https://github.com/anthropics/claude-code/releases
| 系统 | 文件 |
|---|---|
| Windows | claude-win32-x64.zip |
| Linux (Ubuntu) | claude-linux-x64.tar.gz |
Windows 安装¶
-
解压后将
claude.exe放到以下路径: -
在 Git Bash 中将该路径添加到
PATH(永久生效): -
推荐使用 Git Bash 作为终端(安装 Git 客户端时选择安装 Git Bash)。
Linux 安装¶
配置 DeepSeek API¶
使用 Git Bash 运行以下命令(Windows 和 Linux 操作完全相同,永久生效):
echo 'export ANTHROPIC_BASE_URL="https://api.deepseek.com/anthropic/v1"' >> ~/.bashrc
echo 'export ANTHROPIC_AUTH_TOKEN="<你的API_KEY>"' >> ~/.bashrc
echo 'export ANTHROPIC_MODEL="deepseek-v4-pro[1m]"' >> ~/.bashrc
echo 'export ANTHROPIC_DEFAULT_OPUS_MODEL="deepseek-v4-pro[1m]"' >> ~/.bashrc
echo 'export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-v4-pro[1m]"' >> ~/.bashrc
echo 'export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4-flash"' >> ~/.bashrc
echo 'export CLAUDE_CODE_SUBAGENT_MODEL="deepseek-v4-flash"' >> ~/.bashrc
echo 'export CLAUDE_CODE_EFFORT_LEVEL="max"' >> ~/.bashrc
source ~/.bashrc