WSL2 在开启 Windows 代理情况下安装 Codex CLI 的完整步骤
本文档提供两种方法在 WSL2 中使用 Windows 代理,并完成 Codex CLI 安装与登录。 方法一:通过 Windows 主机 IP 使用代理(适用于默认 NAT 网络) 步骤一:确认 Windows 代理端口 在 Windows PowerShell 或 CMD 执行 reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer 输出示例 ProxyServer REG_SZ 127.0.0.1:9674 说明 Windows 系统代理地址为 127.0.0.1:9674 步骤二:获取 Windows 在 WSL 网络中的 IP 进入 WSL 终端执行 grep nameserver /etc/resolv.conf 输出示例 nameserver 172.20.128.1 其中 172.20.128.1 为 Windows 主机在 WSL 网络中的地址。 步骤三:在 WSL 设置代理 在 WSL 终端执行 export http_proxy=http://172.20.128.1:9674 export https_proxy=http://172.20.128.1:9674 export HTTP_PROXY=http://172.20.128.1:9674 export HTTPS_PROXY=http://172.20.128.1:9674 步骤四:测试代理 执行 ...