Encountering "-bash: /usr/local/bin/pip3: /usr/bin/python3.6: bad interpreter: No such file or directory" while checking the pip3 version
I installed pip3 for my current python version
$ python -V
Python 3.5.1+
I used this command to install pip3
sudo apt install python3-pip
When I tried to check out the version of pip
$ pip3 -V
I got
-bash: /usr/local/bin/pip3: /usr/bin/python3.6: bad interpreter: No such file or directory
Previously I had installed python3.6 and deleted it.
Here is the approval:
$ sudo apt remove python3.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'python3.6' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Here is my ${PATH}
$ echo ${PATH}
/home/user/.local/share/umake/bin:/home/user/.local/share/umake/bin:/home/user/.local/share/umake/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/snap/bin
How do I fix path for my current pip?
Solution 1:
Run the command
which python3
to show the path to the python3 executable. In the commands in step 2, I am assuming that it is the default which is/usr/bin/python3
-
Create a symbolic link at
/usr/bin/python3.6
which references to file/usr/bin/python3
.sudo ln -s /usr/bin/python3 /usr/bin/python3.6
Solution 2:
Type in a terminal (I used the VSCode terminal, because my default terminal with Ctrl + Alt + T won't work).
sudo update-alternatives --config python3
See the terminal output You will be prompted to select the path for your python3, In my case I've selected option number 1 (I want the option that says python3.6 manual mode).
Now everything should work fine (terminal , software update manager, python etc).