Qwen Code 安装与使用指南
Qwen Code 是阿里云推出的 AI 编程助手,能够帮助开发者提高编码效率。
系统要求
- Node.js 18.0 或更高版本
- npm 或 yarn 包管理器
- 支持的 IDE:VS Code、JetBrains 系列
安装步骤
1. 安装 Node.js
# macOS brew install node@18Ubuntu/Debian
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt-get install -y nodejs
Windows
访问 https://nodejs.org 下载安装包
2. 安装 Qwen Code CLI
npm install -g @anthropic/qwen-code或者使用 yarn
yarn global add @anthropic/qwen-code
3. 配置 API Key
qwen-code config set api_key YOUR_API_KEY
qwen-code config set model qwen-max
基本使用
代码生成
qwen-code generate "创建一个快速排序函数"
代码解释
qwen-code explain ./src/utils.ts
代码优化
qwen-code optimize ./src/main.py --level 2
常见问题
Q: 安装时遇到权限错误?
A: 使用 sudo 命令或以管理员身份运行终端。
Q: API 调用失败?
A: 检查 API Key 是否正确配置,网络连接是否正常。