OpenClaw Installation Guide English Version)

openclaw openclaw中文博客 2

Overview

OpenClaw is an open-source AI coding assistant project, designed to automate software development tasks through natural language instructions.

OpenClaw Installation Guide English Version)-第1张图片-OpenClaw 中文版 - 真正能做事的 AI

System Requirements

  • Operating System: Ubuntu 20.04+, macOS 12+, or Windows 10/11 (WSL2 recommended for Windows)
  • Memory: Minimum 8GB RAM (16GB+ recommended)
  • Storage: 20GB available space
  • Python: 3.9 or 3.10
  • Git: Latest version

Step 1: Environment Setup

Linux/macOS

# Clone the repository
git clone https://github.com/openclew/OpenClaw.git
cd OpenClaw
# Create virtual environment
python -m venv openclaw_env
source openclaw_env/bin/activate  # On macOS/Linux
# For macOS with Apple Silicon
# Ensure Rosetta 2 is installed if using x86 Python

Windows (WSL2 Recommended)

# In WSL2 terminal
git clone https://github.com/openclew/OpenClaw.git
cd OpenClaw
python -m venv openclaw_env
source openclaw_env/bin/activate

Step 2: Install Dependencies

# Upgrade pip
pip install --upgrade pip
# Install core requirements
pip install -r requirements.txt
# Additional dependencies for specific features
pip install openai anthropic  # For API integrations

Step 3: Configuration

  1. Create environment file:

    cp .env.example .env
  2. Edit .env file with your preferred editor:

    # API Keys (choose one primary provider)
    OPENAI_API_KEY=your_openai_key_here
    ANTHROPIC_API_KEY=your_anthropic_key_here
    # or use local models
    USE_LOCAL_MODEL=true
    LOCAL_MODEL_PATH=./models

Application settings

LOG_LEVEL=INFO MAX_TOKENS=4000


## Step 4: Model Setup
### Option A: Cloud API (Recommended for beginners)
- Obtain API key from OpenAI or Anthropic
- Add to `.env` file as shown above
### Option B: Local Models
```bash
# Download model (example using Ollama)
curl -fsSL https://ollama.com/install.sh | sh
ollama pull codellama:7b
# Or download directly
mkdir -p models
# Download model files to ./models directory

Step 5: Database Setup

# Initialize database
python scripts/init_db.py
# Run migrations if applicable
alembic upgrade head

Step 6: Launch OpenClaw

Development Mode

python main.py --mode dev

Production Mode

python main.py --mode prod

Docker Alternative

# Build and run with Docker
docker build -t openclaw .
docker run -p 8000:8000 openclaw

Step 7: Verify Installation

  1. Check service status:

    curl http://localhost:8000/health

    Expected response: {"status":"healthy"}

  2. Run test suite:

    pytest tests/ -v
  3. Basic functionality test:

    python -c "from core.claw import OpenClaw; agent = OpenClaw(); print('OpenClaw initialized successfully')"

Troubleshooting

Common Issues

  1. Port already in use:

    # Change port
    python main.py --port 8080
  2. Missing dependencies:

    # Reinstall requirements
    pip install -r requirements.txt --force-reinstall
  3. CUDA errors (for GPU users):

    # Ensure correct torch version
    pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118

Getting Help

  • Documentation: Visit docs/ directory
  • Issues: Check GitHub Issues page
  • Community: Join Discord/Slack channel (links in README)

Next Steps

  1. Explore the web interface at http://localhost:8000
  2. Try example commands in interactive mode
  3. Review configuration options in config/settings.yaml
  4. Integrate with your IDE (VSCode/IntelliJ extensions available)

Uninstallation

# Deactivate and remove virtual environment
deactivate
cd ..
rm -rf OpenClaw openclaw_env
# Remove Docker containers
docker rm -f openclaw_container
docker rmi openclaw

Note: This guide covers standard installation. For advanced setups (Kubernetes, multi-node deployment, custom integrations), refer to the docs/advanced_deployment.md file in the repository.

Support: For additional help, create an issue on GitHub or contact the maintainers at support@openclaw.dev

抱歉,评论功能暂时关闭!