I have a confusing situation with my python installation on ubuntu.
$ python --version
Python 3.4.0
$ python2 --version
Python 3.4.0
$ python3 --version
Python 3.4.0
$ ls -la /usr/bin/python2
lrwxrwxrwx 1 root root 9 Dez 21 2013 /usr/bin/python2 -> python2.7
$ ls -la /usr/bin/python3
lrwxrwxrwx 1 root root 9 Mär 23 2014 /usr/bin/python3 -> python3.4
All I wanted was to have python3.4 executed under the command "python".
So I copies /usr/bin/python3 to /usr/bin/python, because python --version
returned 2.7 and now it returns 3.4. I don't know if this was a mistake.
I tried to install a package with pip and that failed. Then I tried to reinstall python (sudo apt-get install --reinstall python
) and the terminal gave me the hint to run "apt-get -f install" without package name.
$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
8 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up python2.7 (2.7.6-8) ...
File "/usr/lib/python2.7/py_compile.py", line 114
except Exception,err:
^
SyntaxError: invalid syntax
dpkg: error processing package python2.7 (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python:
python depends on python2.7 (>= 2.7.5-1~); however:
Package python2.7 is not configured yet.
dpkg: error processing package python (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-dateutil:
python-dateutil depends on python (>= 2.7); however:
Package python is not configured yet.
python-dateutil depends on python (<< 2.8); however:
Package python is not configured yet.
python-dateutil depends on python:any (>= 2.7.1-0ubuntu2); however:
Package python is not configured yet.
dpkg: error processing package python-dateutil (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-gst-1.0:
python-gst-1.0 depends on python (>= 2.7); however:
Package python is not configured yet.
python-gst-1.0 depends on python (<< 2.8); however:
Package python is not configured yet.
python-gst-1.0 depends oNo apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
n python:any (>= 2.7.1-0ubuntu2); however:
Package python is not configured yet.
dpkg: error processing package python-gst-1.0 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-pyparsing:
python-pyparsing depends on python (>= 2.7); however:
Package python is not configured yet.
python-pyparsing depends on python (<< 2.8); however:
Package python is not configured yet.
python-pyparsing depends on python:any (>= 2.7.1-0ubuntu2); however:
Package python is not configured yet.
dpkg: error processing package python-pyparsing (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-tz:
python-tz depends on python (>= 2.7); however:
Package python is not configured yet.
python-tz depends on python (<< 2.8); however:
Package python is not configured yet.
python-tz depends on python:any (>= 2.7.1-0ubuntu2); however:
Package python is not configured yet.
dpkg: error processing package python-tz (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-support:
python-support depends on python (>= 2.5); however:
Package python is not configured yet.
dpkg: error processing package python-support (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-matplotlib:
python-matplotlib depends on python-dateutil; however:
Package python-dateutil is not configured yet.
python-matplotlib depends on python-pyparsing; however:
Package python-pyparsing is not configured yet.
python-matplotlib depends on python-tz; however:
Package python-tz is not configured yet.
python-matplotlib depends on python (<< 2.8); however:
Package python is not configured yet.
python-matplotlib depends on python (>= 2.7); however:
Package python is not configured yet.
python-matplotlib depends on python-support (>= 0.90.0); however:
Package python-support is not configured yet.
dpkg: error processing package python-matplotlib (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python2.7
python
python-dateutil
python-gst-1.0
python-pyparsing
python-tz
python-support
python-matplotlib
E: Sub-process /usr/bin/dpkg returned an error code (1)
$
I already tried to change the links back:
$ sudo cp /usr/bin/python2.7 /usr/bin/python
$ python --version
Python 3.4.0
$ sudo cp /usr/bin/python2 /usr/bin/python
$ python --version
Python 3.4.0
$
What am I supposed to do to get python2 and python3? How can I reinstall python using apt-get?