使用自制软件取消链接 python 的问题

Problems with unlinking python using homebrew

我想从我的 Mac 中卸载 python,因为我在使用它时遇到一些问题并想重新安装它。

因此,我尝试使用 brew unlink python。但是,当我尝试这样做时,控制台会抛出以下错误:

Unlinking /usr/local/Cellar/python/3.7.4... Error: No such file or directory @ realpath_rec - /usr/local/opt/python

由于上述问题,现在我无法使用 python,但我也无法重新安装它。我能做什么?

symlink 似乎丢失了。转载:

% rm /usr/local/opt/python
rm: remove symbolic link '/usr/local/opt/python'? y

% brew unlink python
Unlinking /usr/local/Cellar/python/3.7.4... Error: No such file or directory @ realpath_rec - /usr/local/opt/python

% brew reinstall  --force python
==> Reinstalling python
Error: python 3.7.4 is already installed
To install 3.7.4, first run `brew unlink python`.

重新创建 link...

% ln -s /usr/local/Cellar/python/3.7.4/bin/python3 /usr/local/opt/python
'/usr/local/opt/python' -> '/usr/local/Cellar/python/3.7.4/bin/python3'

您应该可以取消link 或卸载:

% brew unlink python
Unlinking /usr/local/Cellar/python/3.7.4... 22 symlinks removed

% brew uninstall python
Uninstalling /usr/local/Cellar/python/3.7.4... (3,865 files, 60MB)