0

I had python2 installed in my ubuntu (19.04) and I wanted to get it upgraded to 3.7. I installed the 3.7 but still the version showed as 2.7. but I could run python3 and go to the console and python3.7 executable was available in /usr/bin. Did try all the tricks available in internet without any luck. then I decided to delete python2.7 executable from the /usr/bin and now I cannot even run pip as it tries to find the deleted 2.7 I guess. Getting the following message.

bash: /usr/bin/pip: /usr/bin/python: bad interpreter: No such file or directory

I don't know why it's still trying to find 2.7 like ex girl friend when 3.7 is installed and available in the machine.

achala wb
  • 5
  • 1

2 Answers2

0

Did you set up a path for python 3.7 in your .bashrc file? If not, try that and that should help.

Usually a path is something like:


$ export PATH=$HOME/Nek5000/bin:$PATH

Qasim
  • 1
  • 1
0

First, run an update to make sure that there aren’t newer versions of the required packages.

sudo apt update --fix-missing

Next, you can try forcing Apt to look for and correct any missing dependencies or broken packages. This will actually install any missing packages and repair existing installs.

sudo apt install -f

(Source)

Also, always remember - never install directly in global environment. You should always create a local environment first(i recommend venv) as there are very high chances you can break something globally. You can create a local environment by -

python3 -m venv tutorial-env

where tutorial-env is the name of your environment. To activate this environment, you should run

source tutorial-tutorial-env/bin/activate 
  • I'm getting the following message when I try to execute sudo apt update --fix-missing : Could not get lock /var/lib/apt/lists/lock. It is held by process 1002 (packagekitd) - open (11: Resource temporarily unavailable) N: Be aware that removing the lock file is not a solution and may break your system. E: Unable to lock directory /var/lib/apt/lists/ – achala wb May 24 '20 at 09:30