I don\'t know what\'s the deal but I am stuck following some stackoverflow solutions which gets nowhere. Can you please help me on this?
Monas-MacBook-Pro:
Editing the first line of this file worked to me:
MBP-de-Jose:~ josejunior$ which python3
/usr/local/Cellar/python/3.7.3/bin/python3
MBP-de-Jose:~ josejunior$
before
#!/usr/local/opt/python/bin/python3.7
after
#!/usr/local/Cellar/python/3.7.3/bin/python3
In my case, I decided to remove the homebrew python installation from my mac as I already had two other versions of python installed on my mac through MacPorts. This caused the error message.
Reinstalling python through brew solved my issue.
For me, on centOS 7 I had to remove the old pip link from /bin by
rm /bin/pip2.7
rm /bin/pip
then relink it with
sudo ln -s /usr/local/bin/pip2.7 /bin/pip2.7
Then if
/usr/local/bin/pip2.7
Works, this should work
All you need to do is... close the terminal window and reopen new one to fix this issue.
The issue is, new python path is not added to bashrc(Either source or new terminal window would help).
TLDR: pip
found in your path a is a symlink and the referenced location no longer contains the executable. You need to update the symlink.
It helps to understand a couple of things.
python
or pip
you os will search /etc/paths
to try to find the associated executable for that command. You can see everything in there by using cat /etc/paths
.which
, you can type which python
or which pip
. This will tell you the location of the executable that your shell will use for that command./etc/paths
to contain /usr/local/bin
, its also common for /usr/local/bin
to be a bunch of symlinks to the actual executables. Not the executables themselves.bad interpreter: No such file or directory
With that being said the problem is likely that pip
is a symlink and the linked executable probably doesn't exist at that location anymore. To fix it do the following
which pip
(gives something like this /usr/local/bin/pip
)ls -l /usr/local/bin/pip | grep pip
(give something like this pip -> /usr/local/opt/python@3.7/bin/pip3
)ls /usr/local/opt/python@3.7/bin/pip3
(you are having this issue so it probably doesn't).rm -r /usr/local/bin/pip
pip
executable if using homebrew
it will be in /usr/local/opt
you can use something like ls /usr/local/opt/ | grep python
to find it.ln -s /usr/local/opt/python@3.7/bin/pip3 /usr/local/bin/pip
Because I had both python 2 and 3 installed on Mac OSX I was having all sorts of errors.
I used which to find the location of my python2.7 file (/usr/local/bin/python2.7)
which python2.7
Then I symlinked my real python2.7 install location with the one the script expected:
ln -s /usr/local/bin/python2.7 /usr/local/opt/python/bin/python2.7