2

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?

  • 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. – Sushan 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
0

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

| improve this answer | |
  • a little more detail with how you made the export would make the answer more helpful... – precise 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. – Sushan Ghimire Dec 29 '13 at 19:52
  • sorry.. my ignorance.. – precise Dec 30 '13 at 4:45

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.