2

Preamble: I tried looking up a solution and nothing worked for me.

First, when I run the following command

$ sudo python --version
Python 2.7.5+

Similarly for python2 and 3

$ sudo python2 --version
Python 2.7.5+
$ sudo python3 --version
Python 2.7.5+

I get the same exact thing

When I try to, for example, install firefox

sudo apt-get install firefox

I get the problem this person is having

I want to uninstall Python3 and just use 2.7

First, the solution did not work for me. Rather, I am not exactly sure what this person is saying in how you specify.

Two, I can't reinstall python3


Update

I reinstalled python 3.4.3 from source and when I check the version of python3 I still get python 2.7.5+.


Reply to Michael Lindman

root@bl-bc-120431:/home/lab/Desktop/Python-3.4.3# ls -al /usr/bin/ |grep python
lrwxrwxrwx  1 root root          26 Feb  4  2014 dh_pypy -> ../share/dh-python/dh_pypy
-rwxr-xr-x  1 root root        1056 Sep 19  2013 dh_python2
lrwxrwxrwx  1 root root          29 Feb  4  2014 dh_python3 -> ../share/dh-python/dh_python3
-rwxr-xr-x  1 root root          94 Feb 27  2014 idle-python2.7
lrwxrwxrwx  1 root root          23 Feb 27  2014 pdb2.7 -> ../lib/python2.7/pdb.py
lrwxrwxrwx  1 root root          23 Feb 27  2014 pdb3.3 -> ../lib/python3.3/pdb.py
lrwxrwxrwx  1 root root          31 Feb  4  2014 py3versions -> ../share/python3/py3versions.py
lrwxrwxrwx  1 root root          26 Feb  4  2014 pybuild -> ../share/dh-python/pybuild
lrwxrwxrwx  1 root root           9 Sep 19  2013 python -> python2.7
lrwxrwxrwx  1 root root           9 Sep 19  2013 python2 -> python2.7
-rwxr-xr-x  1 root root     3336168 Feb 27  2014 python2.7
lrwxrwxrwx  1 root root          33 Feb 27  2014 python2.7-config -> x86_64-linux-gnu-python2.7-config
-rwxr-xr-x  1 root root         178 Dec 14  2011 python2.7-pyrexc
lrwxrwxrwx  1 root root          16 Sep 19  2013 python2-config -> python2.7-config
lrwxrwxrwx  1 root root          18 Mar 25 13:57 python3 -> /usr/bin/python2.7
-rwxr-xr-x  1 root root     3928976 Feb 27  2014 python3.3m
lrwxrwxrwx  1 root root          10 Feb  4  2014 python3m -> python3.3m
lrwxrwxrwx  1 root root          16 Sep 19  2013 python-config -> python2.7-config
lrwxrwxrwx  1 root root          29 Sep 19  2013 pyversions -> ../share/python/pyversions.py
-rwxr-xr-x  1 root root        2916 Feb 27  2014 x86_64-linux-gnu-python2.7-config
-rwxr-xr-x  1 root root        2885 Feb 27  2014 x86_64-linux-gnu-python2.7-dbg-config
lrwxrwxrwx  1 root root          33 Sep 19  2013 x86_64-linux-gnu-python-config -> x86_64-linux-gnu-python2.7-config

Second Reply to Michael Lindman

root@bl-bc-120431:/home/lab/Desktop/Python-3.4.3# apt-get install --reinstall python3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apparmor-easyprof apt-clone archdetect-deb bogl-bterm dpkg-repack libdebconfclient0
  libdebian-installer4 python-xkit python3-icu python3-pam rdate sbsigntool
  screen-resolution-extra ubiquity ubiquity-casper ubiquity-frontend-debconf
  ubiquity-ubuntu-artwork
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
57 not fully installed or removed.
Need to get 0 B/9,166 B of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 313616 files and directories currently installed.)
Preparing to replace python3 3.3.2-14ubuntu1 (using .../python3_3.3.2-14ubuntu1_amd64.deb)     ...
/var/lib/dpkg/info/python3.prerm: 5: /var/lib/dpkg/info/python3.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 5: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing /var/cache/apt/archives/python3_3.3.2-14ubuntu1_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/python3.postinst: 47: /var/lib/dpkg/info/python3.postinst: py3compile: not     found
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
 /var/cache/apt/archives/python3_3.3.2-14ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
  • I don't fully understand what you are asking, can you clarify? Also it is just a thought but if running python3 --version outputs Python 2.7.5+ then it might be a problem with Symbolic links. Could you please run ls -al /usr/bin/ | grep python and add it to your question. – Michael Lindman Mar 25 '15 at 19:31
  • Thank you for your reply. I don't know where to post it so I will post it under Michael Lindman in the original post. – ComputerNoob Mar 25 '15 at 19:42
  • As I thought, python3 is symlinked to /usr/bin/python2.7 and is why running python3 returns Python 2.7.5+. – Michael Lindman Mar 25 '15 at 19:47
  • Is there an easy solution for this? – ComputerNoob Mar 25 '15 at 19:53
  • You could try removing the symlink with sudo rm /usr/bin/python3 and reinstalling python3 with sudo apt-get install --reinstalled python3 but I'm not entirely sure if it will work or not. – Michael Lindman Mar 25 '15 at 20:02
-1

The python3.4 source install does not install any python command (surprise!), it installs python3.4. You need to create a symlink or wrapper in order to make 3.4 the default python and/or python3.

  • 1
    Welcome to Ask Ubuntu! ;-) Could you edit your answer and include the exact ln command to perform this? That would make this an excellent answer! :-) Otherwise, I'm sorry to say, the system will be deleting your answer as "low quality" automatically in a few days time... :-( – Fabby Oct 7 '15 at 12:48
  • @leamas As this is still not a complete answer, it's now on the radar of deletion votes. While the system isn't going to necessarily erase your post, the reviewers who review posts might vote to delete this. – Thomas Ward Jun 11 '17 at 0:25
  • Please don't erase my comments. And please understand that these kind of replies makes me less motivated to provide answers here. All this said, this is your show, and you decide the rules. – leamas Jun 12 '17 at 0:56
  • As for the original need for a complete ln command, the short answer is "it depends". It depends on whether you want python 3.4 as a global command or as a user-specific command. And it depends on whether you want it visible as python (probably not) or python3. – leamas Jun 12 '17 at 1:01

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.