fix: install.sh 兼容 Windows venv 布局与 GBK 控制台 - #27
Open
shijinzhan wants to merge 1 commit into
Open
Conversation
Windows(Git Bash / MSYS2)下 python -m venv 生成的可执行目录是 Scripts/ 而非 bin/,且可执行文件带 .exe 后缀,导致私有 venv 安装 分支在 "$VENV_DIR/bin/pip" 处报 No such file or directory 失败。 按实际布局探测(bin 不存在则用 Scripts,tt.exe 存在则链接它), Unix 行为不变。 另外 Windows GBK 控制台下,tt setup 的 rich 输出遇到 ✓ 等字符会 UnicodeEncodeError 崩溃,给 setup 调用加 PYTHONUTF8=1 规避。 已在 Windows 11 + Git Bash + Python 3.13 实测:修复前 install.sh 在 venv 分支失败,修复后完整跑通(安装 + 配置向导 + tt status)。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Windows(Git Bash / MSYS2)下运行官方安装命令失败:
两个原因:
python -m venv生成的可执行目录是Scripts/而非bin/,且可执行文件带.exe后缀(Scripts/pip.exe、Scripts/tt.exe)。脚本写死了$VENV_DIR/bin/pip,uv / pipx 都不可用时会走到私有 venv 分支,直接失败。tt setup在 Windows GBK(cp936)控制台下输出✓等字符时 rich 抛UnicodeEncodeError: 'gbk' codec can't encode character '\u2713',配置向导中途崩溃。改动(仅 install.sh,+11/-3)
bin/不存在则退回Scripts/;链接启动器时优先tt.exe。Unix 行为完全不变。tt setup调用加PYTHONUTF8=1,规避 GBK 编码崩溃(其他平台无影响)。测试
Windows 11 + Git Bash + Python 3.13.14 实测:
curl ... | bash在 venv 分支报bin/pip: No such file or directory退出~/.local/bin/tt可执行 → 配置向导自动完成 →tt status正常出报表bash -n语法检查通过;改动不涉及 Python 代码,CI 无影响。