running Ubuntu 12.04, I had the usual python 2.7 in place .
I needed python 2.6 , so I downloaded the source and did
./configure
make
sudo make install
A mistake, as I did not want to replace my system-wide python .
Now some programs stopped working , e.g. update-manager with
ImportError: No module named gi.repository
I used update-alternatives to make python 2.7 default again, but many python applications still won't start up because of some missing modules .
Can someone give a hint what happened and what the best way to fix it would be?
Thanks in advance.
Edit :
I could get some functionality of apt-get to work by setting my own hard link from /etc/python to /etc/python2.7 .
( So I guess using update-alternatives really did not do much good eithe. )
I did a dist-upgrade , which basically worked, but a lot of the package managing via apt-get is still broken.
In particular, a problem with python-minimal prevents many other installations of packages I wanted to do .
Setting up python-minimal (2.7.3-0ubuntu7) ...
Traceback (most recent call last):
File "/usr/local/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/local/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/compileall.py", line 16, in <module>
import struct
File "/usr/local/lib/python2.7/struct.py", line 1, in <module>
from _struct import *
ImportError: No module named _struct
dpkg: error processing python-minimal (--configure):
subprocess installed post-installation script returned error exit status 255
PS:
Building 2.7 from source always did exit (also before dist-ugprade or update-alternatives) with
make: *** [libinstall] Error 1
Currently, on make , there are more issues (" Python build finished, but the necessary bits to build these modules were not found:
_bsddb bsddb185 bz2
dl imageop sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
")
As this is a little over my head , I guess I am just better off with a fresh install from scratch .
Best Answer
I had a similar problem when I downgraded from debian/Testing to debian/Stable recently. I guess somewhere in the process, python modules got corrupted. Purging and reinstalling python was, as it was pointed out, a bit draconian. Thankfully, I came across the following http://ubuntuforums.org/showthread.php?t=735693
Following this suggestion, I tried the command
to reinstall anything that has python in its name, and that solved the problem.