Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm running Ubuntu 11.04 machine. I had accidentally removed Python2.7.2 which I've sorted now, GUI is running and all other commands like easy_install, pip are working.

But when I type any apt commands like apt-get, apt-cache I get following error:

/usr/bin/python: can't find '_ _main _ _' module in '/usr/share/command-not-found'

How can I fix this?

share|improve this question
    
You are probably missing the command-not-found and command-not-found-data packages, try reinstalling these, if you cant reinstall them with apt-get, try using aptitude if you already have it installed. –  nisshh Aug 1 '12 at 10:11
    
What happens when you try sudo apt-get -f install? –  Mitch Aug 1 '12 at 10:31
1  
Adding to @nisshh's suggestion: if you have no aptitude installed, you could try downloading the packages from packages.ubuntu.com (command-not-found plus command-not-found-data) and install them manually using sudo dpkg -i command*.deb –  Izzy Aug 1 '12 at 11:05
2  
Thanks everyone I have solved it. Basically it would give me same(given above) error no matter what try. So I logged out and pressed ALT+CTRL+F1 to enter tty1. There all the apt commands worked. Once I logged back in, I had issues with PATH variable which I had to export. –  Mr Ghimire Aug 1 '12 at 11:38
    
Sounds like this is resolved. Please submit an answer and mark your question as answered. :) –  Huckle Aug 5 '12 at 5:14

1 Answer 1

up vote 0 down vote accepted

Thanks everyone I have solved it.

Basically it would give me same error (error given above) no matter what try. So I logged out and pressed ALT+CTRL+F1 to enter tty1. There all the apt commands worked. Once I logged back in, I had issues with PATH variable which I had to export

share|improve this answer
    
a little more detail with how you made the export would make the answer more helpful... –  rusty Dec 27 '13 at 8:37
    
Export scripts on a .bashrc file and load it on startup. Anyway exporting PATH variables is out of the scope of this question. –  Mr Ghimire Dec 29 '13 at 19:52
    
sorry.. my ignorance.. –  rusty Dec 30 '13 at 4:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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