Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Ubuntu , I changed my system default python version from python2.6 -> python2.7.


sh-3.1$: update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2

sh-3.1$: sudo update-alternatives --config python

There are 2 choices for the alternative python (providing /usr/bin/python).

  Selection    Path                Priority   Status
  0            /usr/bin/python2.7   2         auto mode
  1            /usr/bin/python2.7   2         manual mode
* 2            /usr/lib/python2.7   1         manual mode

Press enter to keep the current choice[*], or type selection number: 0
update-alternatives: using /usr/bin/python2.7 to provide /usr/bin/python (python) in auto mode.

I think I changed the default version, and the command python shows normal.

sh-3.1$: python
Python 2.7.1 (r271:86832, Jul 20 2011, 10:41:38) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

but after I run:

sh-3.1#: sudo dpkg --configure -a
Setting up opera (11.50.1074) ...
Traceback (most recent call last):
  File "/usr/sbin/update-software-center", line 21, in <module>
    import apt
ImportError: No module named apt
dpkg: error processing opera (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up python-piston-mini-client (0.3+bzr32-0ubuntu1) ...
Traceback (most recent call last):
  File "/usr/lib/python2.6/", line 122, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.6/", line 34, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.6/", line 168, in <module>
  File "/usr/lib/python2.6/", line 160, in main
    compile(filename, doraise=True)
  File "/usr/lib/python2.6/", line 115, in compile
    f = open(file, 'U')
IOError: [Errno 2] No such file or directory: '-'
dpkg: error processing python-piston-mini-client (--configure):
 subprocess installed post-installation script returned error exit status 255
dpkg: dependency problems prevent configuration of software-center:
 software-center depends on python-piston-mini-client (>= 0.1+bzr29); however:
  Package python-piston-mini-client is not configured yet.
dpkg: error processing software-center (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:

The error shows that apt-get still use a python2.6 version.

How do I fix it?

share|improve this question

Try updating your apt-get with:

sudo apt-get update
share|improve this answer
Already did that many times, doesn't work. – Leona Apr 26 '12 at 9:30
Try here the 4th and 5th posts onwards... – Silviu Apr 26 '12 at 9:53

Your Answer


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.