I am trying to install dependencies using
Dev$ which python /Users/Dev/anaconda/bin/python Dev$ which python3 /usr/local/bin/python3 Dev$ pip --version pip 10.0.1 from /usr/local/lib/python2.7/site-packages/pip (python 2.7) Dev$ pip3 --version -bash: /usr/local/bin/pip3: /usr/local/opt/python3/bin/python3.6: bad interpreter: No such file or directory
I have no idea why my
pip3 command is not working.
I have tried things like this:
brew link --overwrite python
You’ve got a whole slew of different Python installations, plus at least one former Python installation that you deleted.
Situations like this are exactly why running
pip3 directly is no longer recommended, in favor of:
python3 -m pip install whatever
This guarantees that you’re absolutely positively running the
pip that goes with whatever
python3 means, while
pip3 just means you’re running the
pip that goes with some Python 3.x, which may be any of the various ones you’ve installed.
Or, even better, use virtual environments, so you can rely on the fact that
pip are the commands from the currently-active environment, and not even worry about what they mean system-wide.
But, if you want to know how you got into this mess and how to fix it:
python3 command is probably from a Homebrew Python (you can check;
ls -l /usr/local/bin/python3 and see if it’s a symlink to something in
pip3 command is from a Python 3 that doesn’t exist. Most likely, you installed another Python 3, which overwrote the
pip3 from the Homebrew Python 3, and then uninstalled it, leaving a broken
The simplest thing to do is to just
rm /usr/local/bin/pip3. Then, assuming you want your Homebrew Python to be your default for
pip3, redo the
brew link python command. If it shows you any warnings or errors, you still have other things to fix. If not,
/usr/local/bin/pip3 should now be the Homebrew 3.6
which pip3 should pick out
/usr/local/bin/pip3, and everything is good until the next time you install another Python 3 and overwrite a bunch of stuff.
A better fix would be to pick one way of installing Python—whether Anaconda, Homebrew, python.org installers, or whatever—and use that consistently. Uninstall everything, reinstall the one you actually want, and never touch the others again. (Unfortunately, you will still be stuck with Apple’s system Python 2.7, but if you’re only using 3.x, that won’t matter.)
You can try to change the python version of pip by doing
Then change the commented line (first line) with the desired version of Python.
I’ll made an addition, maybe it can help to someone.
python3.9 installation at this moment, but I get an error message like TS reported:
/home/username/.local/bin/pip: bad interpreter: /usr/bin/python3.6: No such file or directory
I found that files
pip exists in
~/.local/bin direcotry with following shebang (note that explicit Python version specified):
But since I have not 3.6 version on my system, calling
obviously causes this error. Replacing
3.9 fixes it.
please check your python version on your current environment,ensure it’s python3
sudo apt install python[2|3]-pip pip2 install ws4py==0.3.2
I’ve faced the same situation, after above, my program working properly,
Ubuntu 16.04.6 amd64
I have the same problem.
For me the path of python in
venv/bin/pip was wrong.
1. Open pip:
#!/home/saeed/project-master/venv/bin/python3.9 # -*- coding: utf-8 -*- import re import sys
2. Correct the python path in the first line of
#!/home/saeed/project/venv/bin/python3.9 # -*- coding: utf-8 -*- import re import sys