5

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?

3
  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

  2. 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
    
| improve this answer | |
  • 1
    Hi, karel. Thank you for the reply. That's right which python3 has been giving me ==> /usr/bin/python3. But I've got this after trying to create symlink ==> ln: failed to create symbolic link '/usr/bin/python3.6': File exists. Is there other way to fix this? Python is really sophisticated with all it's versions. – fuser May 27 '17 at 13:26
  • It should be noted that you should not remove the python 3.6 file if this is the only version of python3 installed on your system or if python3.6 is your default python3 or you may break your system. /usr/bin/python3 is not an actual file, it is a link to your default installed python3 executable. – mchid Feb 29 at 22:57
2

Type in a terminal ( I used the VSCode terminal, because my default terminal with Ctrl + Alt + T won't work )

  1. 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 )

  1. Now everything should work fine ( terminal , software update manager, python etc)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.