Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mac os12.4 python: error: Failed to locate 'python'

Tags:

python

macos

this error comes when I type cd ./

python: error: Failed to locate 'python'. 
xcode-select: Failed to locate 'python', requesting installation of command line developer tools.
like image 705
Taylor Hu Avatar asked Sep 10 '25 03:09

Taylor Hu


2 Answers

If you don't want to install Xcode app, you should try this.

This worked for me

Original answer in apple developers forum

sudo ln -s /Library/Developer/CommandLineTools/usr/bin/python3 /Library/Developer/CommandLineTools/usr/bin/python

This command creates the required python binary for xcode-select.

like image 116
fakie Avatar answered Sep 12 '25 17:09

fakie


if it's related to any tools that require xcode-install you want to use /Applications/Xcode.app/Contents/Developer/usr/bin/python3 which points to some ../Library/Frameworks/Python3.framework/Versions

like: sudo ln -s /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Applications/Xcode.app/Contents/Developer/usr/bin/python

like image 38
tim Avatar answered Sep 12 '25 18:09

tim