使用thefuck报错ModuleNotFoundError: No module named ‘distutils‘
使用如下命令安装thefuck后
uv tool install --python=3.12 thefuck又在~/.zshrc里(我用的是ohmyzsh)配置了:eval $(thefuck --alias)
然而,执行命令时,却报了如下错误:
Traceback (most recent call last):File "/Users/mac10.12/.local/bin/thefuck", line 4, in <module>from thefuck.entrypoints.main import mainFile "/Users/mac10.12/.local/share/uv/tools/thefuck/lib/python3.12/site-packages/thefuck/entrypoints/main.py", line 2, in <module>from ..system import init_outputFile "/Users/mac10.12/.local/share/uv/tools/thefuck/lib/python3.12/site-packages/thefuck/system/__init__.py", line 7, in <module>from .unix import * # noqa: F401,F403^^^^^^^^^^^^^^^^^^^File "/Users/mac10.12/.local/share/uv/tools/thefuck/lib/python3.12/site-packages/thefuck/system/unix.py", line 6, in <module>from distutils.spawn import find_executable
ModuleNotFoundError: No module named 'distutils'原因是Python3.12把distutils从标准库里移除了
解决方案一:采用<=3.11的python版本
解决方案二:采用未正式发布的thefuck补丁版
已经配置了github的ssh可以这样安装
uv tool install --python=3.12 "thefuck @git+ssh://git@github.com/waketzheng/thefuck"未配置ssh或挂了外网代理的,可以直接用http:
uv tool install --python=3.12 "thefuck @git+https://github.com/waketzheng/thefuck"