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 ??


harish@harish-lap:~$ apt-cache policy 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


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

EDIT 3 :

harish@harish-desktop:~/dl_class_1.9/execute$ sudo find /usr -type f -name 'python'
[sudo] password for harish: 
harish@harish-desktop:~/dl_class_1.9/execute$ command -v python
  • 1
    Edit your question and add the output of apt-cache policy python and the output of type python – A.B. Sep 19 '15 at 17:56
  • How did you install the old version? (Python 2.7.4) – kos Sep 22 '15 at 11:13
  • It was there when I installed the OS ! Now if I try to uninstall, I am scared as to what is going to removed, since I also seem to python 3 and python 2.7 and now python 2.5 – user35952 Sep 22 '15 at 11:20
  • Edit your question and add the output of env python and echo $PATH – A.B. Sep 22 '15 at 11:29
  • Edit you question and add the output of find /usr -type f -name 'python' – A.B. Sep 22 '15 at 12:10

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
  • Nope, still doesn't work, python still looks at python 2.5 only – user35952 Sep 22 '15 at 12:02
  • Won't removing /usr/local/bin/python affect anything so much ?? – user35952 Sep 22 '15 at 12:20
  • No, and if so, then we fix the problem too. – A.B. Sep 22 '15 at 12:23
  • may be if I just rename that directory as some thing like unnamed, isn't it equivalent to delete it – user35952 Sep 22 '15 at 12:28
  • Yes, I have added the command. – A.B. Sep 22 '15 at 12:33

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.