I am using a mac
and my end goal is for which python
to return
/usr/bin/python2.7
The above path exists and it is an executable that works fine.
At present which python
incorrectly returns
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
echo $PYTHON
returns /usr/bin/python2.7
correctly thus issue is about fixing the result from which
command.
I am using zsh
.
I have already tried source ~/.zshrc
and also restarted the laptop. Same outcome.
This is what I get when I echo $PATH
/Users/myname/.nvm/versions/node/v16.16.0/bin:/usr/bin:/Users/myname/.sdkman/candidates/java/current/bin:/Users/myname/.nvm/versions/node/v16.16.0/bin:/usr/bin/python2.7:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/myname/tools/apache-maven-3.8.1/bin:/Users/myname/tools/apache-maven-3.8.1/bin
This is what I have in my .zshrc
file.
export PYTHON="/usr/bin/python2.7"
export PATH="$PYTHON:$PATH"
Full file for reference
export PYTHON="/usr/bin/python2.7"
export PATH="$PYTHON:$PATH"
# Believe only the above 2 lines is relevant. Leaving the rest in just in case.
export M2_HOME=/Users/name/tools/apache-maven-3.8.1
export PATH=$PATH:$M2_HOME/bin
export NODEJS_ORG_MIRROR=https://myserver-proxy
export NVM_NODEJS_ORG_MIRROR=$NODEJS_ORG_MIRROR
export NODE_ENV=development
export NODE_CERTS="/Users/name/certs.pem"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="robbyrussell"
plugins=(git)
source $ZSH/oh-my-zsh.sh
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
export JETBRAINS_LICENSE_SERVER="http://jetbrains.something.com:443"
What am I missing?
UPDATE:
Command: ls -lah /usr/bin/python2.7
Result: ls: /usr/bin/python2.7: No such file or directory
There is no result as shown above. But I can go to usr/bin. Then typing python2.7 opens interactive shell to write python code.
Reason I am looking to resolve which command for python here.
I am installing a node project and getting the following error.
Thus trying to fix the python path to get this installation to work.
gyp info using node-gyp@3.8.0
gyp info using node@14.18.2 | darwin | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "/usr/bin/python2.7" in the PATH
gyp verb `which` failed Error: not found: /usr/bin/python2.7
gyp verb `which` failed at getNotFoundError (/Users/name/projects/fe/aa/node_modules/which/which.js:13:12)
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "/usr/bin/python2.7", you can set the PYTHON env variable.