From 0910ed988cb69d98a27f9474a40b0b645f079c17 Mon Sep 17 00:00:00 2001 From: Pillar Date: Wed, 4 Mar 2026 18:08:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E5=AE=89=E8=A3=85=E5=89=8D=E5=B0=9D?= =?UTF-8?q?=E8=AF=95=E6=9B=B4=E6=96=B0pip=20=E5=A2=9E=E5=8A=A0windows?= =?UTF-8?q?=E4=B8=AD=E5=9B=BD=E5=A4=A7=E9=99=86=E6=BF=80=E6=B4=BB=E6=97=B6?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E7=A2=B0=E5=88=B0=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++++++ env.ps1 | 2 ++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 43a466b..20cd129 100644 --- a/README.md +++ b/README.md @@ -82,3 +82,11 @@ set-executionpolicy remotesigned 方案 A:每次重启 PowerShell 时,都需要输入命令 `~/.env/env.ps1`,以激活环境变量。(PLAN A: Each time you restart PowerShell, you need to enter the command `~/.env/env.ps1` to activate the environment variable.) 方案 B (推荐):打开 `C:\Users\user\Documents\WindowsPowerShell`,如果没有`WindowsPowerShell`则新建该文件夹。新建文件 `Microsoft.PowerShell_profile.ps1`,然后写入 `~/.env/env.ps1` 内容即可,它将在你重启 PowerShell 时自动执行,无需再执行方案 A 中的命令。(or PLAN B (recommended): Open `C:\Users\user\Documents\WindowsPowerShell` and create a new file `Microsoft.PowerShell_profile.ps1`. Then write `~/.env/env.ps1` to the file. It will be executed automatically when you restart PowerShell, without having to execute the command in scenario A.) + +### 常见问题 + +对于中国大陆用户,请注意首次激活 Env 时可能出现错误,这可能是当前网络下使用的镜像(默认清华源)连接失败,修复方法: + +1. 再次进入安装 Env 的目录,运行`.\install_windows.ps1 --gitee`重新安装,并在**安装完成后不要激活 Env**。 +2. 打开 `~/.env/env.ps1` 文件,修改 `python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple` 和 `pip install -i https://pypi.tuna.tsinghua.edu.cn/simple "$PSScriptRoot\tools\scriptse` 中的镜像地址 `https://pypi.tuna.tsinghua.edu.cn/simple` 为其他可用的镜像。 +3. 激活 Env。 \ No newline at end of file diff --git a/env.ps1 b/env.ps1 index dd4cc7f..f1c483d 100644 --- a/env.ps1 +++ b/env.ps1 @@ -18,8 +18,10 @@ if (-not (Test-Path -Path $VENV_ROOT)) { } if ($china) { Write-Host "Detected China Mainland IP, using Tsinghua PyPI mirror." + python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple pip install -i https://pypi.tuna.tsinghua.edu.cn/simple "$PSScriptRoot\tools\scripts" } else { + python -m pip install --upgrade pip pip install "$PSScriptRoot\tools\scripts" } } else {