简体   繁体   中英

Problems with unlinking python using homebrew

I want to uninstall python from my Mac since I have some troubles with it and want to reinstall it.

Thus, I've tried to use brew unlink python . However, the console throws the following error, when I try that:

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

Now I'm not able to use python due to the mentioned troubles, but I'm not able to reinstall it either. What can I do?

The symlink appears to be missing. Reproduced:

% 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`.

Recreate the 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'

and you should be able to unlink or uninstall:

% 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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM