LangChain 实战系列(一) —— 在 Windows 上安装 LangChain 的详细步骤

目录

[1. 环境要求](#1. 环境要求)

系统要求

硬件建议

[2. 安装步骤](#2. 安装步骤)

[步骤 1:安装 Python](#步骤 1:安装 Python)

[步骤 2:创建虚拟环境(推荐)](#步骤 2:创建虚拟环境(推荐))

[步骤 3:安装 LangChain](#步骤 3:安装 LangChain)

[步骤 4:安装 LLM 提供商支持](#步骤 4:安装 LLM 提供商支持)

[步骤 5:安装可视化工具(可选)](#步骤 5:安装可视化工具(可选))

[步骤 6:验证安装](#步骤 6:验证安装)

[3. 配置开发环境](#3. 配置开发环境)

[Visual Studio Code 配置](#Visual Studio Code 配置)

配置环境变量

[4. 常见问题解决](#4. 常见问题解决)

[问题 1:pip 安装速度慢](#问题 1:pip 安装速度慢)

[问题 2:权限错误](#问题 2:权限错误)

[问题 3:依赖冲突](#问题 3:依赖冲突)

[问题 4:C++ 编译错误(某些包需要)](#问题 4:C++ 编译错误(某些包需要))

[5. 快速测试示例](#5. 快速测试示例)

[6. 下一步](#6. 下一步)


1. 环境要求

系统要求

  • Windows 10 或更高版本

  • Python 3.8 或更高版本

  • 建议使用 Windows 11 以获得更好的开发体验

硬件建议

  • 至少 8GB RAM(推荐 16GB+)

  • 至少 10GB 可用磁盘空间

  • 稳定的网络连接

2. 安装步骤

步骤 1:安装 Python

  1. 下载 Python

    • 访问 Python 官网

    • 下载 Python 3.9+ 版本(建议 3.10 或 3.11)

    • 选择 Windows installer (64-bit)

  2. 安装 Python

bash 复制代码
# 安装时务必勾选以下选项:
- ✅ Add Python to PATH(重要!)
- ✅ Install launcher for all users

3.验证安装

bash 复制代码
# 打开 PowerShell 或 CMD
python --version
# 应该显示 Python 3.x.x

pip --version
# 应该显示 pip 版本

步骤 2:创建虚拟环境(推荐)

  1. 使用 venv 创建虚拟环境
bash 复制代码
# 创建项目目录
mkdir langchain-project
cd langchain-project

# 创建虚拟环境
python -m venv venv

# 激活虚拟环境
# PowerShell:
venv\Scripts\Activate.ps1
# 如果遇到执行策略问题,运行:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

# CMD:
venv\Scripts\activate.bat

2. 验证虚拟环境

bash 复制代码
# 激活后,命令行前应显示 (venv)
(venv) D:\langchain-project>

步骤 3:安装 LangChain

  1. 基础安装
bash 复制代码
pip install langchain

2. 安装核心依赖(推荐)

bash 复制代码
# 安装 LangChain 核心及相关工具
pip install langchain langchain-community

# 安装 OpenAI 集成(如果需要)
pip install openai

# 安装常用工具
pip install python-dotenv  # 环境变量管理
pip install tiktoken       # OpenAI token 计数

3. 安装向量数据库支持

bash 复制代码
# 根据需求选择安装
pip install chromadb       # 轻量级向量数据库
pip install faiss-cpu      # Facebook AI 相似度搜索
pip install sentence-transformers  # 本地 embedding

步骤 4:安装 LLM 提供商支持

根据你的需求选择安装:

bash 复制代码
# OpenAI(最常用)
pip install openai

# Anthropic Claude
pip install anthropic

# Google Gemini
pip install google-generativeai

# 本地模型(需要 GPU)
pip install transformers torch torchvision torchaudio
# 安装 CUDA 版本(如果有 NVIDIA GPU)
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

步骤 5:安装可视化工具(可选)

bash 复制代码
# LangSmith(用于追踪和调试)
pip install langsmith

# Streamlit(用于构建 Web 界面)
pip install streamlit

# Gradio(另一种 UI 框架)
pip install gradio

上述库包的实操记录:

bash 复制代码
(venv) D:\MyProjects>pip install openai
Collecting openai
  Downloading openai-2.16.0-py3-none-any.whl.metadata (29 kB)
Collecting anyio<5,>=3.5.0 (from openai)
  Using cached anyio-4.12.1-py3-none-any.whl.metadata (4.3 kB)
Collecting distro<2,>=1.7.0 (from openai)
  Downloading distro-1.9.0-py3-none-any.whl.metadata (6.8 kB)
Collecting httpx<1,>=0.23.0 (from openai)
  Using cached httpx-0.28.1-py3-none-any.whl.metadata (7.1 kB)
INFO: pip is looking at multiple versions of openai to determine which version is compatible with other requirements. This could take a while.
Collecting openai
  Downloading openai-2.15.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-2.14.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-2.13.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-2.12.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-2.11.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-2.9.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-2.8.1-py3-none-any.whl.metadata (29 kB)
INFO: pip is still looking at multiple versions of openai to determine which version is compatible with other requirements. This could take a while.
  Downloading openai-2.8.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-2.7.2-py3-none-any.whl.metadata (29 kB)
  Downloading openai-2.7.1-py3-none-any.whl.metadata (29 kB)
  Downloading openai-2.7.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-2.6.1-py3-none-any.whl.metadata (29 kB)
INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.
  Downloading openai-2.6.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-2.5.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-2.4.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-2.3.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-2.2.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-2.1.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-2.0.1-py3-none-any.whl.metadata (29 kB)
  Downloading openai-2.0.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.109.1-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.109.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.108.2-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.108.1-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.108.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.107.3-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.107.2-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.107.1-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.107.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.106.1-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.106.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.105.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.104.2-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.104.1-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.104.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.103.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.102.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.101.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.100.2-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.100.1-py3-none-any.whl.metadata (29 kB)
  WARNING: Connection timed out while downloading.
  WARNING: Attempting to resume incomplete download (0 bytes/29 kB, attempt 1)
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/aa/b4/686944f0903c65202e86311ec0f42171e697e4f7324caeee0c318046b738/openai-1.100.1-py3-none-any.whl.metadata
  Downloading openai-1.100.1-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.100.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.99.9-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.99.8-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.99.7-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.99.6-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.99.5-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.99.4-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.99.3-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.99.2-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.99.1-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.99.0-py3-none-any.whl.metadata (29 kB)
  WARNING: Connection timed out while downloading.
  WARNING: Attempting to resume incomplete download (0 bytes/29 kB, attempt 1)
  Downloading openai-1.99.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.98.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.97.2-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.97.1-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.97.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.96.1-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.96.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.95.1-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.95.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.94.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.93.3-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.93.2-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.93.1-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.93.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.92.3-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.92.2-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.92.1-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.92.0-py3-none-any.whl.metadata (29 kB)
  Downloading openai-1.91.0-py3-none-any.whl.metadata (26 kB)
  Downloading openai-1.90.0-py3-none-any.whl.metadata (26 kB)
  Downloading openai-1.89.0-py3-none-any.whl.metadata (26 kB)
  Downloading openai-1.88.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.87.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.86.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.85.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.84.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.83.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.82.1-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.82.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.81.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.80.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.79.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.78.1-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.78.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.77.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.76.2-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.76.1-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.76.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.75.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.74.1-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.74.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.73.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.72.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.71.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.70.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.69.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.68.2-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.68.1-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.68.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.67.0-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.66.5-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.66.3-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.66.2-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.66.1-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.66.0-py3-none-any.whl.metadata (25 kB)
  Downloading openai-1.65.5-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.65.4-py3-none-any.whl.metadata (27 kB)
  WARNING: Connection timed out while downloading.
  WARNING: Attempting to resume incomplete download (0 bytes/27 kB, attempt 1)
  Downloading openai-1.65.4-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.65.3-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.65.2-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.65.1-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.65.0-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.64.0-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.63.2-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.63.1-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.63.0-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.62.0-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.61.1-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.61.0-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.60.2-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.60.1-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.60.0-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.59.9-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.59.8-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.59.7-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.59.6-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.59.5-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.59.4-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.59.3-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.59.2-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.58.1-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.58.0-py3-none-any.whl.metadata (27 kB)
  Downloading openai-1.57.4-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.57.3-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.57.2-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.57.1-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.57.0-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.56.2-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.56.1-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.56.0-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.55.3-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.55.2-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.55.1-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.55.0-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.54.5-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.54.4-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.54.3-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.54.2-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.54.1-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.54.0-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.53.1-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.53.0-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.52.2-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.52.1-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.52.0-py3-none-any.whl.metadata (24 kB)
  WARNING: Connection timed out while downloading.
  WARNING: Attempting to resume incomplete download (0 bytes/24 kB, attempt 1)
  Downloading openai-1.52.0-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.51.2-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.51.1-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.51.0-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.50.2-py3-none-any.whl.metadata (24 kB)
  WARNING: Connection timed out while downloading.
  WARNING: Attempting to resume incomplete download (0 bytes/24 kB, attempt 1)
  Downloading openai-1.50.2-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.50.1-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.50.0-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.49.0-py3-none-any.whl.metadata (24 kB)
  WARNING: Connection timed out while downloading.
  WARNING: Attempting to resume incomplete download (0 bytes/24 kB, attempt 1)
  Downloading openai-1.49.0-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.48.0-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.47.1-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.47.0-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.46.1-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.46.0-py3-none-any.whl.metadata (24 kB)
  Downloading openai-1.45.1-py3-none-any.whl.metadata (22 kB)
  Downloading openai-1.45.0-py3-none-any.whl.metadata (22 kB)
  Downloading openai-1.44.1-py3-none-any.whl.metadata (22 kB)
  Downloading openai-1.44.0-py3-none-any.whl.metadata (22 kB)
  Downloading openai-1.43.1-py3-none-any.whl.metadata (22 kB)
  Downloading openai-1.43.0-py3-none-any.whl.metadata (22 kB)
  Downloading openai-1.42.0-py3-none-any.whl.metadata (22 kB)
  Downloading openai-1.41.1-py3-none-any.whl.metadata (22 kB)
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/b6/62/940a75b447ffb607be7840df3602ba2c75b9a1504364d9837b187deacc33/openai-1.41.0-py3-none-any.whl.metadata
  Downloading openai-1.41.0-py3-none-any.whl.metadata (22 kB)
  Downloading openai-1.40.8-py3-none-any.whl.metadata (22 kB)
  Downloading openai-1.40.7-py3-none-any.whl.metadata (22 kB)
  Downloading openai-1.40.6-py3-none-any.whl.metadata (22 kB)
  Downloading openai-1.40.5-py3-none-any.whl.metadata (22 kB)
  Downloading openai-1.40.4-py3-none-any.whl.metadata (22 kB)
  Downloading openai-1.40.3-py3-none-any.whl.metadata (22 kB)
  Downloading openai-1.40.2-py3-none-any.whl.metadata (22 kB)
  Downloading openai-1.40.1-py3-none-any.whl.metadata (22 kB)
  Downloading openai-1.40.0-py3-none-any.whl.metadata (22 kB)
  Downloading openai-1.39.0-py3-none-any.whl.metadata (22 kB)
Collecting pydantic<3,>=1.9.0 (from openai)
  Using cached pydantic-2.12.5-py3-none-any.whl.metadata (90 kB)
Collecting sniffio (from openai)
  Downloading sniffio-1.3.1-py3-none-any.whl.metadata (3.9 kB)
Collecting tqdm>4 (from openai)
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/d0/30/dc54f88dd4a2b5dc8a0279bdd7270e735851848b762aeb1c1184ed1f6b14/tqdm-4.67.1-py3-none-any.whl.metadata
  Downloading tqdm-4.67.1-py3-none-any.whl.metadata (57 kB)
Collecting typing-extensions<5,>=4.7 (from openai)
  Using cached typing_extensions-4.15.0-py3-none-any.whl.metadata (3.3 kB)
Collecting idna>=2.8 (from anyio<5,>=3.5.0->openai)
  Using cached idna-3.11-py3-none-any.whl.metadata (8.4 kB)
Collecting certifi (from httpx<1,>=0.23.0->openai)
  Using cached certifi-2026.1.4-py3-none-any.whl.metadata (2.5 kB)
Collecting httpcore==1.* (from httpx<1,>=0.23.0->openai)
  Using cached httpcore-1.0.9-py3-none-any.whl.metadata (21 kB)
Collecting h11>=0.16 (from httpcore==1.*->httpx<1,>=0.23.0->openai)
  Using cached h11-0.16.0-py3-none-any.whl.metadata (8.3 kB)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/annotated-types/
Collecting annotated-types>=0.6.0 (from pydantic<3,>=1.9.0->openai)
  Using cached annotated_types-0.7.0-py3-none-any.whl.metadata (15 kB)
Collecting pydantic-core==2.41.5 (from pydantic<3,>=1.9.0->openai)
  Using cached pydantic_core-2.41.5-cp313-cp313-win_amd64.whl.metadata (7.4 kB)
Collecting typing-inspection>=0.4.2 (from pydantic<3,>=1.9.0->openai)
  Using cached typing_inspection-0.4.2-py3-none-any.whl.metadata (2.6 kB)
Collecting colorama (from tqdm>4->openai)
  Downloading colorama-0.4.6-py2.py3-none-any.whl.metadata (17 kB)
Downloading openai-1.39.0-py3-none-any.whl (336 kB)
Downloading anyio-4.12.1-py3-none-any.whl (113 kB)
Downloading distro-1.9.0-py3-none-any.whl (20 kB)
Downloading httpx-0.28.1-py3-none-any.whl (73 kB)
Downloading httpcore-1.0.9-py3-none-any.whl (78 kB)
Downloading pydantic-2.12.5-py3-none-any.whl (463 kB)
Downloading pydantic_core-2.41.5-cp313-cp313-win_amd64.whl (2.0 MB)
   ---------------------------------------- 0.0/2.0 MB ? eta -:--:--
WARNING: Connection timed out while downloading.
WARNING: Attempting to resume incomplete download (0 bytes/2.0 MB, attempt 1)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None))': /packages/9e/8b/341991b158ddab181cff136acd2552c9f35bd30380422a639c0671e99a91/pydantic_core-2.41.5-cp313-cp313-win_amd64.whl
Downloading pydantic_core-2.41.5-cp313-cp313-win_amd64.whl (2.0 MB)
   -------------------- ------------------- 1.0/2.0 MB ? eta -:--:--
WARNING: Connection timed out while downloading.
WARNING: Attempting to resume incomplete download (1.0 MB/2.0 MB, attempt 2)
Resuming download pydantic_core-2.41.5-cp313-cp313-win_amd64.whl (1.0 MB/2.0 MB)
   ------------------------- -------------- 1.3/2.0 MB ? eta -:--:--
WARNING: Connection timed out while downloading.
WARNING: Attempting to resume incomplete download (1.3 MB/2.0 MB, attempt 3)
Resuming download pydantic_core-2.41.5-cp313-cp313-win_amd64.whl (1.3 MB/2.0 MB)
   ------------------------- -------------- 1.3/2.0 MB ? eta -:--:--
WARNING: Connection timed out while downloading.
WARNING: Attempting to resume incomplete download (1.3 MB/2.0 MB, attempt 4)
Resuming download pydantic_core-2.41.5-cp313-cp313-win_amd64.whl (1.3 MB/2.0 MB)
   ------------------------------------ --- 1.8/2.0 MB ? eta -:--:--
WARNING: Connection timed out while downloading.
WARNING: Attempting to resume incomplete download (1.8 MB/2.0 MB, attempt 5)
Resuming download pydantic_core-2.41.5-cp313-cp313-win_amd64.whl (1.8 MB/2.0 MB)
   ---------------------------------------- 2.0/2.0 MB ?  0:00:33
Downloading typing_extensions-4.15.0-py3-none-any.whl (44 kB)
Downloading annotated_types-0.7.0-py3-none-any.whl (13 kB)
Downloading h11-0.16.0-py3-none-any.whl (37 kB)
Downloading idna-3.11-py3-none-any.whl (71 kB)
Downloading tqdm-4.67.1-py3-none-any.whl (78 kB)
Downloading typing_inspection-0.4.2-py3-none-any.whl (14 kB)
Downloading certifi-2026.1.4-py3-none-any.whl (152 kB)
WARNING: Connection timed out while downloading.
WARNING: Attempting to resume incomplete download (0 bytes/152 kB, attempt 1)
Downloading certifi-2026.1.4-py3-none-any.whl (152 kB)
Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Downloading sniffio-1.3.1-py3-none-any.whl (10 kB)
Installing collected packages: typing-extensions, sniffio, idna, h11, distro, colorama, certifi, annotated-types, typing-inspection, tqdm, pydantic-core, httpcore, anyio, pydantic, httpx, openai
Successfully installed annotated-types-0.7.0 anyio-4.12.1 certifi-2026.1.4 colorama-0.4.6 distro-1.9.0 h11-0.16.0 httpcore-1.0.9 httpx-0.28.1 idna-3.11 openai-1.39.0 pydantic-2.12.5 pydantic-core-2.41.5 sniffio-1.3.1 tqdm-4.67.1 typing-extensions-4.15.0 typing-inspection-0.4.2

(venv) D:\MyProjects>
(venv) D:\MyProjects>
(venv) D:\MyProjects>
(venv) D:\MyProjects>
(venv) D:\MyProjects>pip install python-dotenv
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/python-dotenv/
Collecting python-dotenv
  Using cached python_dotenv-1.2.1-py3-none-any.whl.metadata (25 kB)
Downloading python_dotenv-1.2.1-py3-none-any.whl (21 kB)
Installing collected packages: python-dotenv
Successfully installed python-dotenv-1.2.1

(venv) D:\MyProjects>pip install tiktoken
Collecting tiktoken
  Downloading tiktoken-0.12.0-cp313-cp313-win_amd64.whl.metadata (6.9 kB)
Collecting regex>=2022.1.18 (from tiktoken)
  Downloading regex-2026.1.15-cp313-cp313-win_amd64.whl.metadata (41 kB)
Collecting requests>=2.26.0 (from tiktoken)
  Using cached requests-2.32.5-py3-none-any.whl.metadata (4.9 kB)
Collecting charset_normalizer<4,>=2 (from requests>=2.26.0->tiktoken)
  Downloading charset_normalizer-3.4.4-cp313-cp313-win_amd64.whl.metadata (38 kB)
Requirement already satisfied: idna<4,>=2.5 in d:\myprojects\venv\lib\site-packages (from requests>=2.26.0->tiktoken) (3.11)
Collecting urllib3<3,>=1.21.1 (from requests>=2.26.0->tiktoken)
  Downloading urllib3-2.6.3-py3-none-any.whl.metadata (6.9 kB)
Requirement already satisfied: certifi>=2017.4.17 in d:\myprojects\venv\lib\site-packages (from requests>=2.26.0->tiktoken) (2026.1.4)
Downloading tiktoken-0.12.0-cp313-cp313-win_amd64.whl (879 kB)
   ---------------------------------------- 879.1/879.1 kB 9.6 kB/s  0:01:22
Downloading regex-2026.1.15-cp313-cp313-win_amd64.whl (277 kB)
Downloading requests-2.32.5-py3-none-any.whl (64 kB)
Downloading charset_normalizer-3.4.4-cp313-cp313-win_amd64.whl (107 kB)
Downloading urllib3-2.6.3-py3-none-any.whl (131 kB)
Installing collected packages: urllib3, regex, charset_normalizer, requests, tiktoken
Successfully installed charset_normalizer-3.4.4 regex-2026.1.15 requests-2.32.5 tiktoken-0.12.0 urllib3-2.6.3

(venv) D:\MyProjects>pip install chromadb
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001D1139B96A0>: Failed to establish a new connection: [WinError 10051] 向一个无法连接的网络尝试了一个套接字操作。')': /simple/chromadb/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001D113981F90>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/chromadb/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001D113982210>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/chromadb/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001D113982490>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/chromadb/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001D113982710>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/chromadb/
ERROR: Could not find a version that satisfies the requirement chromadb (from versions: none)
ERROR: No matching distribution found for chromadb

(venv) D:\MyProjects>pip install sentence-transformers
Collecting sentence-transformers
  Downloading sentence_transformers-5.2.2-py3-none-any.whl.metadata (16 kB)
Collecting transformers<6.0.0,>=4.41.0 (from sentence-transformers)
  Downloading transformers-5.0.0-py3-none-any.whl.metadata (37 kB)
Collecting huggingface-hub>=0.20.0 (from sentence-transformers)
  Downloading huggingface_hub-1.3.4-py3-none-any.whl.metadata (13 kB)
Collecting torch>=1.11.0 (from sentence-transformers)
  Downloading torch-2.10.0-cp313-cp313-win_amd64.whl.metadata (31 kB)
Collecting numpy (from sentence-transformers)
  Downloading numpy-2.4.1-cp313-cp313-win_amd64.whl.metadata (6.6 kB)
Collecting scikit-learn (from sentence-transformers)
  Downloading scikit_learn-1.8.0-cp313-cp313-win_amd64.whl.metadata (11 kB)
INFO: pip is looking at multiple versions of sentence-transformers to determine which version is compatible with other requirements. This could take a while.
Collecting sentence-transformers
  Downloading sentence_transformers-5.2.1-py3-none-any.whl.metadata (16 kB)
  Downloading sentence_transformers-5.2.0-py3-none-any.whl.metadata (16 kB)
Requirement already satisfied: tqdm in d:\myprojects\venv\lib\site-packages (from sentence-transformers) (4.67.1)
  Downloading sentence_transformers-5.1.2-py3-none-any.whl.metadata (16 kB)
Collecting transformers<5.0.0,>=4.41.0 (from sentence-transformers)
  Downloading transformers-4.57.6-py3-none-any.whl.metadata (43 kB)
Collecting sentence-transformers
  Downloading sentence_transformers-5.1.1-py3-none-any.whl.metadata (16 kB)
  Downloading sentence_transformers-5.1.0-py3-none-any.whl.metadata (16 kB)
  Downloading sentence_transformers-5.0.0-py3-none-any.whl.metadata (16 kB)
  Downloading sentence_transformers-4.1.0-py3-none-any.whl.metadata (13 kB)
INFO: pip is still looking at multiple versions of sentence-transformers to determine which version is compatible with other requirements. This could take a while.
  Downloading sentence_transformers-4.0.2-py3-none-any.whl.metadata (13 kB)
  Downloading sentence_transformers-4.0.1-py3-none-any.whl.metadata (13 kB)
  Downloading sentence_transformers-4.0.0-py3-none-any.whl.metadata (13 kB)
  Downloading sentence_transformers-3.4.1-py3-none-any.whl.metadata (10 kB)
  Downloading sentence_transformers-3.4.0-py3-none-any.whl.metadata (10 kB)
INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.
  Downloading sentence_transformers-3.3.1-py3-none-any.whl.metadata (10 kB)
  Downloading sentence_transformers-3.3.0-py3-none-any.whl.metadata (10 kB)
  Downloading sentence_transformers-3.2.1-py3-none-any.whl.metadata (10 kB)
  Downloading sentence_transformers-3.2.0-py3-none-any.whl.metadata (10 kB)
  Downloading sentence_transformers-3.1.1-py3-none-any.whl.metadata (10 kB)
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/90/b4/52b8205f24172f2429cacf04bac324414f16b61d64e79c787c9ce2385586/sentence_transformers-3.1.0-py3-none-any.whl.metadata
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000017622243250>: Failed to establish a new connection: [WinError 10051] 向一个无法连接的网络尝试了一个套接字操作。')': /packages/90/b4/52b8205f24172f2429cacf04bac324414f16b61d64e79c787c9ce2385586/sentence_transformers-3.1.0-py3-none-any.whl.metadata
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000017622240B90>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /packages/90/b4/52b8205f24172f2429cacf04bac324414f16b61d64e79c787c9ce2385586/sentence_transformers-3.1.0-py3-none-any.whl.metadata
  Downloading sentence_transformers-3.1.0-py3-none-any.whl.metadata (23 kB)
Collecting numpy<2.0.0 (from sentence-transformers)
  Downloading numpy-1.26.4.tar.gz (15.8 MB)
     - -------------------------------------- 0.5/15.8 MB ? eta -:--:--
  WARNING: Connection timed out while downloading.
  WARNING: Attempting to resume incomplete download (524 kB/15.8 MB, attempt 1)
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/65/6e/09db70a523a96d25e115e71cc56a6f9031e7b8cd166c1ac8438307c14058/numpy-1.26.4.tar.gz
  Resuming download numpy-1.26.4.tar.gz (524 kB/15.8 MB)
     - -------------------------------------- 0.5/15.8 MB ? eta -:--:--
ERROR: Exception:
Traceback (most recent call last):
  File "D:\MyProjects\venv\Lib\site-packages\pip\_vendor\urllib3\response.py", line 438, in _error_catcher
    yield
  File "D:\MyProjects\venv\Lib\site-packages\pip\_vendor\urllib3\response.py", line 561, in read
    data = self._fp_read(amt) if not fp_closed else b""
           ~~~~~~~~~~~~~^^^^^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_vendor\urllib3\response.py", line 527, in _fp_read
    return self._fp.read(amt) if amt is not None else self._fp.read()
           ~~~~~~~~~~~~~^^^^^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 98, in read
    data: bytes = self.__fp.read(amt)
                  ~~~~~~~~~~~~~~^^^^^
  File "C:\Users\jiangping\AppData\Local\Programs\Python\Python313\Lib\http\client.py", line 484, in read
    s = self.fp.read(amt)
  File "C:\Users\jiangping\AppData\Local\Programs\Python\Python313\Lib\socket.py", line 719, in readinto
    return self._sock.recv_into(b)
           ~~~~~~~~~~~~~~~~~~~~^^^
  File "C:\Users\jiangping\AppData\Local\Programs\Python\Python313\Lib\ssl.py", line 1304, in recv_into
    return self.read(nbytes, buffer)
           ~~~~~~~~~^^^^^^^^^^^^^^^^
  File "C:\Users\jiangping\AppData\Local\Programs\Python\Python313\Lib\ssl.py", line 1138, in read
    return self._sslobj.read(len, buffer)
           ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\cli\base_command.py", line 107, in _run_wrapper
    status = _inner_run()
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\cli\base_command.py", line 98, in _inner_run
    return self.run(options, args)
           ~~~~~~~~^^^^^^^^^^^^^^^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\cli\req_command.py", line 85, in wrapper
    return func(self, options, args)
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\commands\install.py", line 388, in run
    requirement_set = resolver.resolve(
        reqs, check_supported_wheels=not options.target_dir
    )
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 99, in resolve
    result = self._result = resolver.resolve(
                            ~~~~~~~~~~~~~~~~^
        collected.requirements, max_rounds=limit_how_complex_resolution_can_be
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_vendor\resolvelib\resolvers\resolution.py", line 601, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "D:\MyProjects\venv\Lib\site-packages\pip\_vendor\resolvelib\resolvers\resolution.py", line 513, in resolve
    failure_criterion = self._attempt_to_pin_criterion(name)
  File "D:\MyProjects\venv\Lib\site-packages\pip\_vendor\resolvelib\resolvers\resolution.py", line 220, in _attempt_to_pin_criterion
    criteria = self._get_updated_criteria(candidate)
  File "D:\MyProjects\venv\Lib\site-packages\pip\_vendor\resolvelib\resolvers\resolution.py", line 211, in _get_updated_criteria
    self._add_to_criteria(criteria, requirement, parent=candidate)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_vendor\resolvelib\resolvers\resolution.py", line 150, in _add_to_criteria
    if not criterion.candidates:
           ^^^^^^^^^^^^^^^^^^^^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_vendor\resolvelib\structs.py", line 194, in __bool__
    return bool(self._sequence)
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 165, in __bool__
    self._bool = any(self)
                 ~~~^^^^^^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 149, in <genexpr>
    return (c for c in iterator if id(c) not in self._incompatible_ids)
                       ^^^^^^^^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 39, in _iter_built
    candidate = func()
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 180, in _make_candidate_from_link
    base: BaseCandidate | None = self._make_base_candidate_from_link(
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        link, template, name, version
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 226, in _make_base_candidate_from_link
    self._link_candidate_cache[link] = LinkCandidate(
                                       ~~~~~~~~~~~~~^
        link,
        ^^^^^
    ...<3 lines>...
        version=version,
        ^^^^^^^^^^^^^^^^
    )
    ^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 318, in __init__
    super().__init__(
    ~~~~~~~~~~~~~~~~^
        link=link,
        ^^^^^^^^^^
    ...<4 lines>...
        version=version,
        ^^^^^^^^^^^^^^^^
    )
    ^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 161, in __init__
    self.dist = self._prepare()
                ~~~~~~~~~~~~~^^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 238, in _prepare
    dist = self._prepare_distribution()
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 329, in _prepare_distribution
    return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\operations\prepare.py", line 543, in prepare_linked_requirement
    return self._prepare_linked_requirement(req, parallel_builds)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\operations\prepare.py", line 614, in _prepare_linked_requirement
    local_file = unpack_url(
        link,
    ...<4 lines>...
        hashes,
    )
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\operations\prepare.py", line 180, in unpack_url
    file = get_http_url(
        link,
    ...<2 lines>...
        hashes=hashes,
    )
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\operations\prepare.py", line 121, in get_http_url
    from_path, content_type = download(link, temp_dir.path)
                              ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\network\download.py", line 197, in __call__
    self._attempt_resumes_or_redownloads(download, resp)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\network\download.py", line 247, in _attempt_resumes_or_redownloads
    self._process_response(download, resume_resp)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\network\download.py", line 212, in _process_response
    for chunk in chunks:
                 ^^^^^^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\cli\progress_bars.py", line 67, in _rich_download_progress_bar
    for chunk in iterable:
                 ^^^^^^^^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_internal\network\utils.py", line 65, in response_chunks
    for chunk in response.raw.stream(
                 ~~~~~~~~~~~~~~~~~~~^
        chunk_size,
        ^^^^^^^^^^^
    ...<22 lines>...
        decode_content=False,
        ^^^^^^^^^^^^^^^^^^^^^
    ):
    ^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_vendor\urllib3\response.py", line 622, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "D:\MyProjects\venv\Lib\site-packages\pip\_vendor\urllib3\response.py", line 560, in read
    with self._error_catcher():
         ~~~~~~~~~~~~~~~~~~~^^
  File "C:\Users\jiangping\AppData\Local\Programs\Python\Python313\Lib\contextlib.py", line 162, in __exit__
    self.gen.throw(value)
    ~~~~~~~~~~~~~~^^^^^^^
  File "D:\MyProjects\venv\Lib\site-packages\pip\_vendor\urllib3\response.py", line 455, in _error_catcher
    raise ProtocolError("Connection broken: %r" % e, e)
pip._vendor.urllib3.exceptions.ProtocolError: ("Connection broken: ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None)", ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None))

(venv) D:\MyProjects>
(venv) D:\MyProjects>pip install anthropic
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/anthropic/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/anthropic/
Collecting anthropic
  Downloading anthropic-0.76.0-py3-none-any.whl.metadata (28 kB)
Requirement already satisfied: anyio<5,>=3.5.0 in d:\myprojects\venv\lib\site-packages (from anthropic) (4.12.1)
Requirement already satisfied: distro<2,>=1.7.0 in d:\myprojects\venv\lib\site-packages (from anthropic) (1.9.0)
Collecting docstring-parser<1,>=0.15 (from anthropic)
  Downloading docstring_parser-0.17.0-py3-none-any.whl.metadata (3.5 kB)
Requirement already satisfied: httpx<1,>=0.25.0 in d:\myprojects\venv\lib\site-packages (from anthropic) (0.28.1)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/jiter/
Collecting jiter<1,>=0.4.0 (from anthropic)
  Downloading jiter-0.12.0-cp313-cp313-win_amd64.whl.metadata (5.3 kB)
Requirement already satisfied: pydantic<3,>=1.9.0 in d:\myprojects\venv\lib\site-packages (from anthropic) (2.12.5)
Requirement already satisfied: sniffio in d:\myprojects\venv\lib\site-packages (from anthropic) (1.3.1)
Requirement already satisfied: typing-extensions<5,>=4.10 in d:\myprojects\venv\lib\site-packages (from anthropic) (4.15.0)
Requirement already satisfied: idna>=2.8 in d:\myprojects\venv\lib\site-packages (from anyio<5,>=3.5.0->anthropic) (3.11)
Requirement already satisfied: certifi in d:\myprojects\venv\lib\site-packages (from httpx<1,>=0.25.0->anthropic) (2026.1.4)
Requirement already satisfied: httpcore==1.* in d:\myprojects\venv\lib\site-packages (from httpx<1,>=0.25.0->anthropic) (1.0.9)
Requirement already satisfied: h11>=0.16 in d:\myprojects\venv\lib\site-packages (from httpcore==1.*->httpx<1,>=0.25.0->anthropic) (0.16.0)
Requirement already satisfied: annotated-types>=0.6.0 in d:\myprojects\venv\lib\site-packages (from pydantic<3,>=1.9.0->anthropic) (0.7.0)
Requirement already satisfied: pydantic-core==2.41.5 in d:\myprojects\venv\lib\site-packages (from pydantic<3,>=1.9.0->anthropic) (2.41.5)
Requirement already satisfied: typing-inspection>=0.4.2 in d:\myprojects\venv\lib\site-packages (from pydantic<3,>=1.9.0->anthropic) (0.4.2)
Downloading anthropic-0.76.0-py3-none-any.whl (390 kB)
Downloading docstring_parser-0.17.0-py3-none-any.whl (36 kB)
Downloading jiter-0.12.0-cp313-cp313-win_amd64.whl (204 kB)
WARNING: Connection timed out while downloading.
WARNING: Attempting to resume incomplete download (0 bytes/204 kB, attempt 1)
Downloading jiter-0.12.0-cp313-cp313-win_amd64.whl (204 kB)
WARNING: Connection timed out while downloading.
WARNING: Attempting to resume incomplete download (0 bytes/204 kB, attempt 2)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/c4/1f/30b0eb087045a0abe2a5c9c0c0c8da110875a1d3be83afd4a9a4e548be3c/jiter-0.12.0-cp313-cp313-win_amd64.whl
Downloading jiter-0.12.0-cp313-cp313-win_amd64.whl (204 kB)
Installing collected packages: jiter, docstring-parser, anthropic
Successfully installed anthropic-0.76.0 docstring-parser-0.17.0 jiter-0.12.0

(venv) D:\MyProjects>pip install langsmith
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/langsmith/
Collecting langsmith
  Downloading langsmith-0.6.6-py3-none-any.whl.metadata (15 kB)
Requirement already satisfied: httpx<1,>=0.23.0 in d:\myprojects\venv\lib\site-packages (from langsmith) (0.28.1)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/orjson/
Collecting orjson>=3.9.14 (from langsmith)
  Using cached orjson-3.11.5-cp313-cp313-win_amd64.whl.metadata (42 kB)
Collecting packaging>=23.2 (from langsmith)
  Downloading packaging-26.0-py3-none-any.whl.metadata (3.3 kB)
Requirement already satisfied: pydantic<3,>=2 in d:\myprojects\venv\lib\site-packages (from langsmith) (2.12.5)
Collecting requests-toolbelt>=1.0.0 (from langsmith)
  Using cached requests_toolbelt-1.0.0-py2.py3-none-any.whl.metadata (14 kB)
Requirement already satisfied: requests>=2.0.0 in d:\myprojects\venv\lib\site-packages (from langsmith) (2.32.5)
Collecting uuid-utils<1.0,>=0.12.0 (from langsmith)
  Downloading uuid_utils-0.14.0-cp39-abi3-win_amd64.whl.metadata (5.0 kB)
  WARNING: Connection timed out while downloading.
  WARNING: Attempting to resume incomplete download (0 bytes/5.0 kB, attempt 1)
  Downloading uuid_utils-0.14.0-cp39-abi3-win_amd64.whl.metadata (5.0 kB)
Collecting zstandard>=0.23.0 (from langsmith)
  Using cached zstandard-0.25.0-cp313-cp313-win_amd64.whl.metadata (3.3 kB)
Requirement already satisfied: anyio in d:\myprojects\venv\lib\site-packages (from httpx<1,>=0.23.0->langsmith) (4.12.1)
Requirement already satisfied: certifi in d:\myprojects\venv\lib\site-packages (from httpx<1,>=0.23.0->langsmith) (2026.1.4)
Requirement already satisfied: httpcore==1.* in d:\myprojects\venv\lib\site-packages (from httpx<1,>=0.23.0->langsmith) (1.0.9)
Requirement already satisfied: idna in d:\myprojects\venv\lib\site-packages (from httpx<1,>=0.23.0->langsmith) (3.11)
Requirement already satisfied: h11>=0.16 in d:\myprojects\venv\lib\site-packages (from httpcore==1.*->httpx<1,>=0.23.0->langsmith) (0.16.0)
Requirement already satisfied: annotated-types>=0.6.0 in d:\myprojects\venv\lib\site-packages (from pydantic<3,>=2->langsmith) (0.7.0)
Requirement already satisfied: pydantic-core==2.41.5 in d:\myprojects\venv\lib\site-packages (from pydantic<3,>=2->langsmith) (2.41.5)
Requirement already satisfied: typing-extensions>=4.14.1 in d:\myprojects\venv\lib\site-packages (from pydantic<3,>=2->langsmith) (4.15.0)
Requirement already satisfied: typing-inspection>=0.4.2 in d:\myprojects\venv\lib\site-packages (from pydantic<3,>=2->langsmith) (0.4.2)
Requirement already satisfied: charset_normalizer<4,>=2 in d:\myprojects\venv\lib\site-packages (from requests>=2.0.0->langsmith) (3.4.4)
Requirement already satisfied: urllib3<3,>=1.21.1 in d:\myprojects\venv\lib\site-packages (from requests>=2.0.0->langsmith) (2.6.3)
Downloading langsmith-0.6.6-py3-none-any.whl (308 kB)
WARNING: Connection timed out while downloading.
WARNING: Attempting to resume incomplete download (0 bytes/308 kB, attempt 1)
Downloading langsmith-0.6.6-py3-none-any.whl (308 kB)
Downloading uuid_utils-0.14.0-cp39-abi3-win_amd64.whl (182 kB)
Downloading orjson-3.11.5-cp313-cp313-win_amd64.whl (133 kB)
Downloading packaging-26.0-py3-none-any.whl (74 kB)
Downloading requests_toolbelt-1.0.0-py2.py3-none-any.whl (54 kB)
WARNING: Connection timed out while downloading.
WARNING: Attempting to resume incomplete download (0 bytes/54 kB, attempt 1)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/3f/51/d4db610ef29373b879047326cbf6fa98b6c1969d6f6dc423279de2b1be2c/requests_toolbelt-1.0.0-py2.py3-none-any.whl
Downloading requests_toolbelt-1.0.0-py2.py3-none-any.whl (54 kB)
WARNING: Connection timed out while downloading.
WARNING: Attempting to resume incomplete download (0 bytes/54 kB, attempt 2)
Downloading requests_toolbelt-1.0.0-py2.py3-none-any.whl (54 kB)
Downloading zstandard-0.25.0-cp313-cp313-win_amd64.whl (506 kB)
Installing collected packages: zstandard, uuid-utils, packaging, orjson, requests-toolbelt, langsmith
Successfully installed langsmith-0.6.6 orjson-3.11.5 packaging-26.0 requests-toolbelt-1.0.0 uuid-utils-0.14.0 zstandard-0.25.0

(venv) D:\MyProjects>pip install streamlit
Collecting streamlit
  Downloading streamlit-1.53.1-py3-none-any.whl.metadata (10 kB)
Collecting altair!=5.4.0,!=5.4.1,<7,>=4.0 (from streamlit)
  Downloading altair-6.0.0-py3-none-any.whl.metadata (11 kB)
Collecting blinker<2,>=1.5.0 (from streamlit)
  Downloading blinker-1.9.0-py3-none-any.whl.metadata (1.6 kB)
Collecting cachetools<7,>=5.5 (from streamlit)
  Downloading cachetools-6.2.6-py3-none-any.whl.metadata (5.6 kB)
Collecting click<9,>=7.0 (from streamlit)
  Downloading click-8.3.1-py3-none-any.whl.metadata (2.6 kB)
Collecting numpy<3,>=1.23 (from streamlit)
  Using cached numpy-2.4.1-cp313-cp313-win_amd64.whl.metadata (6.6 kB)
Requirement already satisfied: packaging>=20 in d:\myprojects\venv\lib\site-packages (from streamlit) (26.0)
Collecting pandas<3,>=1.4.0 (from streamlit)
  Downloading pandas-2.3.3-cp313-cp313-win_amd64.whl.metadata (19 kB)
Collecting pillow<13,>=7.1.0 (from streamlit)
  Downloading pillow-12.1.0-cp313-cp313-win_amd64.whl.metadata (9.0 kB)
Collecting protobuf<7,>=3.20 (from streamlit)
  Downloading protobuf-6.33.4-cp310-abi3-win_amd64.whl.metadata (593 bytes)
INFO: pip is looking at multiple versions of streamlit to determine which version is compatible with other requirements. This could take a while.
Collecting streamlit
  Downloading streamlit-1.53.0-py3-none-any.whl.metadata (10 kB)
  Downloading streamlit-1.52.2-py3-none-any.whl.metadata (9.8 kB)
  Downloading streamlit-1.52.1-py3-none-any.whl.metadata (9.8 kB)
  Downloading streamlit-1.52.0-py3-none-any.whl.metadata (9.8 kB)
  WARNING: Connection timed out while downloading.
  WARNING: Attempting to resume incomplete download (0 bytes/9.8 kB, attempt 1)
  Downloading streamlit-1.52.0-py3-none-any.whl.metadata (9.8 kB)
  Downloading streamlit-1.51.0-py3-none-any.whl.metadata (9.5 kB)
Collecting altair!=5.4.0,!=5.4.1,<6,>=4.0 (from streamlit)
  Downloading altair-5.5.0-py3-none-any.whl.metadata (11 kB)
Collecting packaging<26,>=20 (from streamlit)
  Using cached packaging-25.0-py3-none-any.whl.metadata (3.3 kB)
Collecting streamlit
  Downloading streamlit-1.50.0-py3-none-any.whl.metadata (9.5 kB)
Collecting pillow<12,>=7.1.0 (from streamlit)
  Downloading pillow-11.3.0-cp313-cp313-win_amd64.whl.metadata (9.2 kB)
Collecting streamlit
  Downloading streamlit-1.49.1-py3-none-any.whl.metadata (9.5 kB)
INFO: pip is still looking at multiple versions of streamlit to determine which version is compatible with other requirements. This could take a while.
  Downloading streamlit-1.49.0-py3-none-any.whl.metadata (9.5 kB)
  Downloading streamlit-1.48.1-py3-none-any.whl.metadata (9.5 kB)
  Downloading streamlit-1.48.0-py3-none-any.whl.metadata (9.5 kB)
  Downloading streamlit-1.47.1-py3-none-any.whl.metadata (9.0 kB)
  Downloading streamlit-1.47.0-py3-none-any.whl.metadata (9.0 kB)
INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.
  Downloading streamlit-1.46.1-py3-none-any.whl.metadata (9.0 kB)
  Downloading streamlit-1.46.0-py3-none-any.whl.metadata (9.0 kB)
  Downloading streamlit-1.45.1-py3-none-any.whl.metadata (8.9 kB)
Collecting cachetools<6,>=4.0 (from streamlit)
  Downloading cachetools-5.5.2-py3-none-any.whl.metadata (5.4 kB)
Collecting packaging<25,>=20 (from streamlit)
  Downloading packaging-24.2-py3-none-any.whl.metadata (3.2 kB)
Collecting streamlit
  Downloading streamlit-1.45.0-py3-none-any.whl.metadata (8.9 kB)
  Downloading streamlit-1.44.1-py3-none-any.whl.metadata (8.9 kB)
Collecting protobuf<6,>=3.20 (from streamlit)
  Downloading protobuf-5.29.5-cp310-abi3-win_amd64.whl.metadata (592 bytes)
Collecting streamlit
  Downloading streamlit-1.44.0-py3-none-any.whl.metadata (8.9 kB)
  Downloading streamlit-1.43.2-py2.py3-none-any.whl.metadata (8.9 kB)
  Downloading streamlit-1.43.1-py2.py3-none-any.whl.metadata (8.9 kB)
  Downloading streamlit-1.43.0-py2.py3-none-any.whl.metadata (8.9 kB)
  Downloading streamlit-1.42.2-py2.py3-none-any.whl.metadata (8.9 kB)
  Downloading streamlit-1.42.1-py2.py3-none-any.whl.metadata (8.9 kB)
  Downloading streamlit-1.42.0-py2.py3-none-any.whl.metadata (8.9 kB)
  Downloading streamlit-1.41.1-py2.py3-none-any.whl.metadata (8.5 kB)
  Downloading streamlit-1.41.0-py2.py3-none-any.whl.metadata (8.5 kB)
  Downloading streamlit-1.40.2-py2.py3-none-any.whl.metadata (8.4 kB)
  Downloading streamlit-1.40.1-py2.py3-none-any.whl.metadata (8.5 kB)
  Downloading streamlit-1.40.0-py2.py3-none-any.whl.metadata (8.5 kB)
  Downloading streamlit-1.39.1-py2.py3-none-any.whl.metadata (8.6 kB)
Collecting pillow<11,>=7.1.0 (from streamlit)
  Downloading pillow-10.4.0-cp313-cp313-win_amd64.whl.metadata (9.3 kB)
Collecting streamlit
  Downloading streamlit-1.39.0-py2.py3-none-any.whl.metadata (8.5 kB)
  Downloading streamlit-1.38.0-py2.py3-none-any.whl.metadata (8.5 kB)
  Downloading streamlit-1.37.1-py2.py3-none-any.whl.metadata (8.5 kB)
  Downloading streamlit-1.37.0-py2.py3-none-any.whl.metadata (8.5 kB)
  Downloading streamlit-1.36.0-py2.py3-none-any.whl.metadata (8.5 kB)
  Downloading streamlit-1.35.0-py2.py3-none-any.whl.metadata (8.5 kB)
Collecting numpy<2,>=1.19.3 (from streamlit)
  Downloading numpy-1.26.4.tar.gz (15.8 MB)
     - -------------------------------------- 0.8/15.8 MB ? eta -:--:--
  WARNING: Connection timed out while downloading.
  WARNING: Attempting to resume incomplete download (786 kB/15.8 MB, attempt 1)
  Resuming download numpy-1.26.4.tar.gz (786 kB/15.8 MB)
     - -------------------------------------- 0.8/15.8 MB ? eta -:--:--
  WARNING: Connection timed out while downloading.
  WARNING: Attempting to resume incomplete download (786 kB/15.8 MB, attempt 2)
  Resuming download numpy-1.26.4.tar.gz (786 kB/15.8 MB)
     -- ------------------------------------- 1.0/15.8 MB ? eta -:--:--
  WARNING: Connection timed out while downloading.
  WARNING: Attempting to resume incomplete download (1.0 MB/15.8 MB, attempt 3)
  Resuming download numpy-1.26.4.tar.gz (1.0 MB/15.8 MB)
     -- ------------------------------------- 1.0/15.8 MB ? eta -:--:--
  WARNING: Connection timed out while downloading.
  WARNING: Attempting to resume incomplete download (1.0 MB/15.8 MB, attempt 4)
  Resuming download numpy-1.26.4.tar.gz (1.0 MB/15.8 MB)
     -- ------------------------------------- 1.0/15.8 MB ? eta -:--:--
  WARNING: Connection timed out while downloading.
  WARNING: Attempting to resume incomplete download (1.0 MB/15.8 MB, attempt 5)
  Resuming download numpy-1.26.4.tar.gz (1.0 MB/15.8 MB)
     ------ --------------------------------- 2.6/15.8 MB ? eta -:--:--
  WARNING: Connection timed out while downloading.
ERROR: Could not install packages due to an OSError: [WinError 32] 另一个程序正在使用此文件,进程无法访问。: 'C:\\Users\\jiangping\\AppData\\Local\\Temp\\pip-unpack-chiy09jz\\numpy-1.26.4.tar.gz'
Check the permissions.


(venv) D:\MyProjects>pip install langchain
Collecting langchain
  Downloading langchain-1.2.7-py3-none-any.whl.metadata (4.9 kB)
Collecting langchain-core<2.0.0,>=1.2.7 (from langchain)
  Using cached langchain_core-1.2.7-py3-none-any.whl.metadata (3.7 kB)
Collecting langgraph<1.1.0,>=1.0.7 (from langchain)
  Downloading langgraph-1.0.7-py3-none-any.whl.metadata (7.4 kB)
Requirement already satisfied: pydantic<3.0.0,>=2.7.4 in d:\myprojects\venv\lib\site-packages (from langchain) (2.12.5)
Collecting jsonpatch<2.0.0,>=1.33.0 (from langchain-core<2.0.0,>=1.2.7->langchain)
  Using cached jsonpatch-1.33-py2.py3-none-any.whl.metadata (3.0 kB)
Requirement already satisfied: langsmith<1.0.0,>=0.3.45 in d:\myprojects\venv\lib\site-packages (from langchain-core<2.0.0,>=1.2.7->langchain) (0.6.6)
Collecting packaging<26.0.0,>=23.2.0 (from langchain-core<2.0.0,>=1.2.7->langchain)
  Using cached packaging-25.0-py3-none-any.whl.metadata (3.3 kB)
Collecting pyyaml<7.0.0,>=5.3.0 (from langchain-core<2.0.0,>=1.2.7->langchain)
  Using cached pyyaml-6.0.3-cp313-cp313-win_amd64.whl.metadata (2.4 kB)
Collecting tenacity!=8.4.0,<10.0.0,>=8.1.0 (from langchain-core<2.0.0,>=1.2.7->langchain)
  Using cached tenacity-9.1.2-py3-none-any.whl.metadata (1.2 kB)
Requirement already satisfied: typing-extensions<5.0.0,>=4.7.0 in d:\myprojects\venv\lib\site-packages (from langchain-core<2.0.0,>=1.2.7->langchain) (4.15.0)
Requirement already satisfied: uuid-utils<1.0,>=0.12.0 in d:\myprojects\venv\lib\site-packages (from langchain-core<2.0.0,>=1.2.7->langchain) (0.14.0)
Collecting jsonpointer>=1.9 (from jsonpatch<2.0.0,>=1.33.0->langchain-core<2.0.0,>=1.2.7->langchain)
  Using cached jsonpointer-3.0.0-py2.py3-none-any.whl.metadata (2.3 kB)
Collecting langgraph-checkpoint<5.0.0,>=2.1.0 (from langgraph<1.1.0,>=1.0.7->langchain)
  Using cached langgraph_checkpoint-4.0.0-py3-none-any.whl.metadata (4.9 kB)
Collecting langgraph-prebuilt<1.1.0,>=1.0.7 (from langgraph<1.1.0,>=1.0.7->langchain)
  Downloading langgraph_prebuilt-1.0.7-py3-none-any.whl.metadata (5.2 kB)
Collecting langgraph-sdk<0.4.0,>=0.3.0 (from langgraph<1.1.0,>=1.0.7->langchain)
  Using cached langgraph_sdk-0.3.3-py3-none-any.whl.metadata (1.6 kB)
Collecting xxhash>=3.5.0 (from langgraph<1.1.0,>=1.0.7->langchain)
  Using cached xxhash-3.6.0-cp313-cp313-win_amd64.whl.metadata (13 kB)
Collecting ormsgpack>=1.12.0 (from langgraph-checkpoint<5.0.0,>=2.1.0->langgraph<1.1.0,>=1.0.7->langchain)
  Downloading ormsgpack-1.12.2-cp313-cp313-win_amd64.whl.metadata (3.3 kB)
Requirement already satisfied: httpx>=0.25.2 in d:\myprojects\venv\lib\site-packages (from langgraph-sdk<0.4.0,>=0.3.0->langgraph<1.1.0,>=1.0.7->langchain) (0.28.1)
Requirement already satisfied: orjson>=3.10.1 in d:\myprojects\venv\lib\site-packages (from langgraph-sdk<0.4.0,>=0.3.0->langgraph<1.1.0,>=1.0.7->langchain) (3.11.5)
Requirement already satisfied: requests-toolbelt>=1.0.0 in d:\myprojects\venv\lib\site-packages (from langsmith<1.0.0,>=0.3.45->langchain-core<2.0.0,>=1.2.7->langchain) (1.0.0)
Requirement already satisfied: requests>=2.0.0 in d:\myprojects\venv\lib\site-packages (from langsmith<1.0.0,>=0.3.45->langchain-core<2.0.0,>=1.2.7->langchain) (2.32.5)
Requirement already satisfied: zstandard>=0.23.0 in d:\myprojects\venv\lib\site-packages (from langsmith<1.0.0,>=0.3.45->langchain-core<2.0.0,>=1.2.7->langchain) (0.25.0)
Requirement already satisfied: anyio in d:\myprojects\venv\lib\site-packages (from httpx>=0.25.2->langgraph-sdk<0.4.0,>=0.3.0->langgraph<1.1.0,>=1.0.7->langchain) (4.12.1)
Requirement already satisfied: certifi in d:\myprojects\venv\lib\site-packages (from httpx>=0.25.2->langgraph-sdk<0.4.0,>=0.3.0->langgraph<1.1.0,>=1.0.7->langchain) (2026.1.4)
Requirement already satisfied: httpcore==1.* in d:\myprojects\venv\lib\site-packages (from httpx>=0.25.2->langgraph-sdk<0.4.0,>=0.3.0->langgraph<1.1.0,>=1.0.7->langchain) (1.0.9)
Requirement already satisfied: idna in d:\myprojects\venv\lib\site-packages (from httpx>=0.25.2->langgraph-sdk<0.4.0,>=0.3.0->langgraph<1.1.0,>=1.0.7->langchain) (3.11)
Requirement already satisfied: h11>=0.16 in d:\myprojects\venv\lib\site-packages (from httpcore==1.*->httpx>=0.25.2->langgraph-sdk<0.4.0,>=0.3.0->langgraph<1.1.0,>=1.0.7->langchain) (0.16.0)
Requirement already satisfied: annotated-types>=0.6.0 in d:\myprojects\venv\lib\site-packages (from pydantic<3.0.0,>=2.7.4->langchain) (0.7.0)
Requirement already satisfied: pydantic-core==2.41.5 in d:\myprojects\venv\lib\site-packages (from pydantic<3.0.0,>=2.7.4->langchain) (2.41.5)
Requirement already satisfied: typing-inspection>=0.4.2 in d:\myprojects\venv\lib\site-packages (from pydantic<3.0.0,>=2.7.4->langchain) (0.4.2)
Requirement already satisfied: charset_normalizer<4,>=2 in d:\myprojects\venv\lib\site-packages (from requests>=2.0.0->langsmith<1.0.0,>=0.3.45->langchain-core<2.0.0,>=1.2.7->langchain) (3.4.4)
Requirement already satisfied: urllib3<3,>=1.21.1 in d:\myprojects\venv\lib\site-packages (from requests>=2.0.0->langsmith<1.0.0,>=0.3.45->langchain-core<2.0.0,>=1.2.7->langchain) (2.6.3)
Downloading langchain-1.2.7-py3-none-any.whl (108 kB)
Downloading langchain_core-1.2.7-py3-none-any.whl (490 kB)
Downloading jsonpatch-1.33-py2.py3-none-any.whl (12 kB)
Downloading langgraph-1.0.7-py3-none-any.whl (157 kB)
Downloading langgraph_checkpoint-4.0.0-py3-none-any.whl (46 kB)
Downloading langgraph_prebuilt-1.0.7-py3-none-any.whl (35 kB)
Downloading langgraph_sdk-0.3.3-py3-none-any.whl (67 kB)
Downloading packaging-25.0-py3-none-any.whl (66 kB)
Downloading pyyaml-6.0.3-cp313-cp313-win_amd64.whl (154 kB)
WARNING: Connection timed out while downloading.
WARNING: Attempting to resume incomplete download (0 bytes/154 kB, attempt 1)
Downloading pyyaml-6.0.3-cp313-cp313-win_amd64.whl (154 kB)
Downloading tenacity-9.1.2-py3-none-any.whl (28 kB)
Downloading jsonpointer-3.0.0-py2.py3-none-any.whl (7.6 kB)
Downloading ormsgpack-1.12.2-cp313-cp313-win_amd64.whl (117 kB)
Downloading xxhash-3.6.0-cp313-cp313-win_amd64.whl (31 kB)
Installing collected packages: xxhash, tenacity, pyyaml, packaging, ormsgpack, jsonpointer, jsonpatch, langgraph-sdk, langchain-core, langgraph-checkpoint, langgraph-prebuilt, langgraph, langchain
  Attempting uninstall: packaging
    Found existing installation: packaging 26.0
    Uninstalling packaging-26.0:
      Successfully uninstalled packaging-26.0
Successfully installed jsonpatch-1.33 jsonpointer-3.0.0 langchain-1.2.7 langchain-core-1.2.7 langgraph-1.0.7 langgraph-checkpoint-4.0.0 langgraph-prebuilt-1.0.7 langgraph-sdk-0.3.3 ormsgpack-1.12.2 packaging-25.0 pyyaml-6.0.3 tenacity-9.1.2 xxhash-3.6.0

(venv) D:\MyProjects>

步骤 6:验证安装

  1. 创建测试文件
python 复制代码
# test_installation.py
import sys

def check_installation():
    try:
        import langchain
        print(f"✅ LangChain 版本: {langchain.__version__}")
        
        import openai
        print("✅ OpenAI 已安装")
        
        import chromadb
        print("✅ ChromaDB 已安装")
        
        print("\n✅ 所有包安装成功!")
        return True
        
    except ImportError as e:
        print(f"❌ 导入失败: {e}")
        return False

if __name__ == "__main__":
    check_installation()

运行测试

bash 复制代码
python test_installation.py

3. 配置开发环境

Visual Studio Code 配置

  1. 安装 VS Code

  2. 推荐扩展

    • Python

    • Jupyter

    • Pylance

    • GitLens

    • Code Runner

  3. 配置 Python 解释器

    • Ctrl+Shift+P

    • 输入 "Python: Select Interpreter"

    • 选择虚拟环境中的 Python 路径

配置环境变量

  1. 创建 .env 文件
XML 复制代码
# .env
OPENAI_API_KEY=your_openai_api_key_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here
GOOGLE_API_KEY=your_google_api_key_here

# LangSmith(可选)
LANGCHAIN_API_KEY=your_langsmith_api_key
LANGCHAIN_TRACING_V2=true
LANGCHAIN_PROJECT=your_project_name

2. 加载环境变量

python 复制代码
# 在 Python 代码中
from dotenv import load_dotenv
load_dotenv()

4. 常见问题解决

问题 1:pip 安装速度慢

bash 复制代码
# 使用国内镜像源
pip install langchain -i https://pypi.tuna.tsinghua.edu.cn/simple

# 或永久配置
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

问题 2:权限错误

bash 复制代码
# 使用管理员权限运行 PowerShell
# 或使用用户安装
pip install --user langchain

问题 3:依赖冲突

bash 复制代码
# 创建新的干净虚拟环境
python -m venv new_venv
new_venv\Scripts\activate
pip install langchain

问题 4:C++ 编译错误(某些包需要)

bash 复制代码
# 安装 Visual C++ Build Tools
# 下载地址:https://visualstudio.microsoft.com/visual-cpp-build-tools/

5. 快速测试示例

创建一个简单的 LangChain 应用:

python 复制代码
# quick_test.py
from langchain.llms import OpenAI
from langchain.prompts import PromptTemplate
from langchain.chains import LLMChain
import os
from dotenv import load_dotenv

# 加载环境变量
load_dotenv()

# 检查 API 密钥
if not os.getenv("OPENAI_API_KEY"):
    print("⚠️ 请先设置 OPENAI_API_KEY 环境变量")
    print("在 .env 文件中添加:OPENAI_API_KEY=your_key_here")
else:
    # 初始化 LLM
    llm = OpenAI(temperature=0.7)
    
    # 创建模板
    template = """
    请用中文回答以下问题:
    
    问题:{question}
    
    回答:
    """
    
    prompt = PromptTemplate(
        input_variables=["question"],
        template=template
    )
    
    # 创建链
    chain = LLMChain(llm=llm, prompt=prompt)
    
    # 运行链
    question = "LangChain 是什么?"
    response = chain.run(question)
    
    print(f"问题:{question}")
    print(f"回答:{response}")

运行测试:

bash 复制代码
python quick_test.py

6. 下一步

现在你已经成功安装了 LangChain,接下来可以:

  1. 学习 LangChain 核心概念(Chains, Agents, Memory 等)

  2. 尝试不同的 LLM 提供商

  3. 构建你的第一个 LangChain 应用

  4. 学习如何使用向量数据库和 RAG

相关推荐
njsgcs3 小时前
langchain框架怎么让 Skills 与 MCP(tools)协同使用
人工智能·langchain·skills
玄同76518 小时前
LangChain 核心组件全解析:构建大模型应用的 “乐高积木”
人工智能·python·语言模型·langchain·llm·nlp·知识图谱
小芳矶1 天前
使用 Langgraph 构建本地 RAG 知识库:从文档加载到检索
python·langchain
麦兜*1 天前
深入剖析新一代AI Native技术栈:从向量数据库与LangChain应用架构到多模态大模型微调与智能体工作流的全链路实战
数据库·人工智能·langchain
西柚小萌新1 天前
【人工智能:Agent】--11.Langchain高级用法
langchain
薛定谔的猫19821 天前
四、基于LangChain与HuggingFace Pipeline的本地大语言模型对话系统搭建指南(使用阿里千问-模型)
人工智能·语言模型·langchain
花间相见1 天前
【AI开发】—— LangChain框架
人工智能·python·langchain
墨_浅-1 天前
0帧起手学langchain之马冬梅
langchain
BeforeEasy2 天前
从零搭建一个完整的ai-agent小项目
人工智能·langchain