Revert to original version of python

5,216

Your path looks ok. Therefore a first shot:

Reinstall the original Python package via

sudo apt-get install --reinstall python

to overwrite the previous installation.

But your last edit (Edit 3) gives the solution. Remove the binary in /usr/local/bin via

sudo rm /usr/local/bin/python

or rename the file

sudo mv /usr/local/bin/python /usr/local/bin/python-2.5.4
Share:
5,216

Related videos on Youtube

user35952
Author by

user35952

Updated on September 18, 2022

Comments

  • user35952
    user35952 over 1 year

    I am trying to install a package called nmoldyn in my system. This package caused havoc in my system. It required some packages in python, so what it precisely did was install an older version of python (v 2.5.4) and tried to install other packages along with it. But somehow it was not able to install matplotlib (may be it was trying to install an old version and it was not available from the repository). The major trouble it has caused is that it has changed my path variable to newer version of python (i.e. v 2.5.4) while I earlier had (v 2.7.2). How do I revert back to old path and environment setting ??

    EDIT 1:

    harish@harish-lap:~$ apt-cache policy python
    python:
      Installed: 2.7.5-5ubuntu3
      Candidate: 2.7.5-5ubuntu3
      Version table:
     *** 2.7.5-5ubuntu3 0
            500 http://in.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
            100 /var/lib/dpkg/status
    harish@harish-lap:~$ type python
    python is /usr/local/bin/python
    

    EDIT 2:

    harish@harish-desktop:~/dl_class_1.9_serial/execute$ env python
    Python 2.5.4 (r254:67916, Sep 16 2015, 16:39:34) 
    [GCC 4.8.4] on linux3
    Type "help", "copyright", "credits" or "license" for more information.
    >>>         
    harish@harish-desktop:~/dl_class_1.9_serial/execute$ echo $PATH
    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
    

    EDIT 3 :

    harish@harish-desktop:~/dl_class_1.9/execute$ sudo find /usr -type f -name 'python'
    [sudo] password for harish: 
    /usr/share/lintian/overrides/python
    /usr/share/bash-completion/completions/python
    /usr/local/bin/python
    harish@harish-desktop:~/dl_class_1.9/execute$ command -v python
    /usr/local/bin/python
    
    • A.B.
      A.B. over 8 years
      Edit your question and add the output of apt-cache policy python and the output of type python
    • kos
      kos over 8 years
      How did you install the old version? (Python 2.7.4)
    • A.B.
      A.B. over 8 years
      Edit your question and add the output of env python and echo $PATH
    • A.B.
      A.B. over 8 years
      Edit you question and add the output of find /usr -type f -name 'python'
    • A.B.
      A.B. over 8 years
      And the output of command -v python
    • Ravan
      Ravan over 8 years
      Since you have accepted the answer,award bounty manually by clicking +50 blue just below tick mark,(you will get benefactor as well),
  • user35952
    user35952 over 8 years
    Nope, still doesn't work, python still looks at python 2.5 only
  • user35952
    user35952 over 8 years
    Won't removing /usr/local/bin/python affect anything so much ??
  • A.B.
    A.B. over 8 years
    No, and if so, then we fix the problem too.
  • user35952
    user35952 over 8 years
    may be if I just rename that directory as some thing like unnamed, isn't it equivalent to delete it
  • A.B.
    A.B. over 8 years
    Yes, I have added the command.
  • user35952
    user35952 over 8 years
    Thank you so much, I will just accept the answer in a while, but just wanted to ask, this didn't completely solve the problem, as am not able to run nMoldyn as such, I have to recompile it differently with different paths I think (earlier it was given as /usr/local/bin, now when I use /usr/bin its saying python is not installed, which means it will install it and do all ruckus again, any reason why its not detecting python. I understand this is different question, but just pardon the inconvenience.
  • A.B.
    A.B. over 8 years
    check the used python binary with command -v python. It should be /usr/bin/python
  • A.B.
    A.B. over 8 years
    Which moldyn, this? github.com/arcan1s/moldyn
  • user35952
    user35952 over 8 years
    It still doesn't agree !! No, nMoldyn by ILL
  • A.B.
    A.B. over 8 years
  • Ravan
    Ravan over 8 years
    Since you have accepted the answer,award bounty manually by clicking +50 blue just below tick mark,(you will get benefactor as well),