Issue
OSError: [Errno 62] Too many levels of symbolic links: '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/Makefile'
I get this error when running virtualenv env
in any folder. Every version of python -m virtualenv env
except python3 returns this error.
Python3 returns dyld[1761]: Library not loaded: @executable_path/../.Python Referenced from: /opt/homebrew/Cellar/[email protected]/3.9.9/Frameworks/Python.framework/Versions/3.9/bin/python3.9 Reason: tried: '/opt/homebrew/Cellar/[email protected]/3.9.9/Frameworks/Python.framework/Versions/3.9/bin/../.Python' (no such file), '/usr/local/lib/.Python' (no such file), '/usr/lib/.Python' (no such file)
I'm running macOS 12.0 Monterey (M1 Pro if that matters).
I've tried a million solutions including turning off SIP and trying to remove system files/folders (which I'm unable to do). I'm at a loss here. Uninstalling and re-installing virtualenv does nothing.
ls -l /usr/bin | grep python
returns
lrwxr-xr-x 1 root wheel 75 18 Sep 09:26 python -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x 1 root wheel 82 18 Sep 09:26 python-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
lrwxr-xr-x 1 root wheel 75 18 Sep 09:26 python2 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x 1 root wheel 75 18 Sep 09:26 python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x 1 root wheel 82 18 Sep 09:26 python2.7-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
-rwxr-xr-x 1 root wheel 137696 18 Sep 09:26 python3
lrwxr-xr-x 1 root wheel 76 18 Sep 09:26 pythonw -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7
lrwxr-xr-x 1 root wheel 76 18 Sep 09:26 pythonw2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7
Along the way of trying to get virtualenv to run python 2.7 I've probably fucked something up and now I'm stuck being unable to use any version.
Before I got this error I was having this error while trying to run virtualenv with 2.7 as the option.
No virtualenv implementation for PythonInfo(spec=CPython2.7.16.final.0-64...
Solution
After some frantic googling I stumbled upon https://unix.stackexchange.com/questions/39333/how-can-i-remove-all-symbolic-links-with-a-special-target. I ran ls -la *
and then unlink /path/to/Makefile
which was something like /Library/Frameworks/Python...
.
Answered By - Ronny Answer Checked By - Dawn Plyler (WPSolving Volunteer)