#1
  1. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2003
    Location
    Thessaloniki
    Posts
    1,285
    Rep Power
    13

    Question Uninstall all previous versions of python


    Hello,

    root@nikos [~]# python -V
    Python 2.6.6
    root@nikos [~]# python3 -V
    Python 3.3.0
    root@nikos [~]# python3.3 -V
    Python 3.3.0

    how can i uninstall all previous version of pythons and just leave 3.3.2 installed please?

    thank you.
    What is now proved was once only imagined!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Location
    Usually Japan when not on contract
    Posts
    240
    Rep Power
    12
    What distribution and package manager are you using?

    In any case, you would do a "which python" and "which python3" to find out where the commands actually point to, and then query your package manager to find out what package owns those files. Then uninstall those packages.

    I can't give specific commands because you haven't said anything about what system you are using -- but if you check the man page for your package system and think through what I wrote above, you can probably figure it out.
  4. #3
  5. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2003
    Location
    Thessaloniki
    Posts
    1,285
    Rep Power
    13
    Originally Posted by zxq9
    What distribution and package manager are you using?

    In any case, you would do a "which python" and "which python3" to find out where the commands actually point to, and then query your package manager to find out what package owns those files. Then uninstall those packages.

    I can't give specific commands because you haven't said anything about what system you are using -- but if you check the man page for your package system and think through what I wrote above, you can probably figure it out.

    I'am using CentOS v6.4
    and yum install manager and

    Code:
    root@nikos [~]# which python
    /usr/bin/python
    root@nikos [~]# which python3
    /root/.local/lib/python2.7/bin/python3
    root@nikos [~]# which python3.3
    /root/.local/lib/python2.7/bin/python3.3
    root@nikos [~]#
    Please give me instreuction to how to uninstall all of thse python and downlaod and install only the latest which would be

    python 3.3.2

    thank you.
    What is now proved was once only imagined!
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Location
    Usually Japan when not on contract
    Posts
    240
    Rep Power
    12
    Uninstalling Python3 is relatively easy: "yum remove python3" if you got it from EPEL or a similar repository.

    Uninstalling python 2.x is a bad idea because most of the core system utilities are written in Python 2.6+. Yum, for example, is a collection of Python 2.6 programs. If you actually do "yum remove python" you will see most of your core system get listed in the uninstall dependency list -- which is a Bad Thing.

    Now in the case of your Python3 installation, it looks like you have two parallel installations of Python3, but you don't. try "ls -l" on /bin/python3.3 and /bin/python3. One is almost certainly a symlink to the other and not an actual installation.

    So your solvable problem is just how to replace Python 3.3 with Python 3.2.

    Do you know what repository you got Python 3.3 from? If you do, check and see if they also carry Python 3.2. If not, just stick with Python 3.3 -- you're not missing anything.

    The key thing to remember writing programs that require a shebang is to do "#! /bin/python3" instead of "#! /bin/python" or use the alternatives system (more of a headache imo).
  8. #5
  9. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2003
    Location
    Thessaloniki
    Posts
    1,285
    Rep Power
    13
    Because iam unexperinced with this stuff can i please give you my logn and pass to do the uninstallation of current many pythons(leaving 2.6) and installation pof python 3.3.2 yourself?

    please accept!
    What is now proved was once only imagined!
  10. #6
  11. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2003
    Location
    Thessaloniki
    Posts
    1,285
    Rep Power
    13
    Everything seem to be workign as expected, my webiste and the other 10 client websites just chhecked.

    luckily i keep my stuff at /homw/nikos so there are untouched.
    i hope i havent deleted anything though system need form /root/.local but i guess this is where root's user personal stuff and instalation of python from source where. i ddidnt know if it has soemhtign else.

    root@nikos [/]# which python
    /usr/bin/python
    root@nikos [/]# which python3
    /root/.local/lib/python2.7/bin/python3
    root@nikos [/]# which python3.3
    /usr/local/bin/python3.3
    root@nikos [/]# ls -l /usr/bin/py
    pydoc pygettext.py python python2.6 python3
    pyflakes pynche python2 python2.6-config python-config
    root@nikos [/]# ls -l /usr/bin/python*
    -rwxr-xr-x 3 root root 4864 Feb 22 02:00 /usr/bin/python*
    lrwxrwxrwx 1 root root 6 Apr 5 20:34 /usr/bin/python2 -> python*
    -rwxr-xr-x 3 root root 4864 Feb 22 02:00 /usr/bin/python2.6*
    -rwxr-xr-x 1 root root 1418 Feb 22 02:00 /usr/bin/python2.6-config*
    lrwxrwxrwx 1 root root 24 Apr 7 22:10 /usr/bin/python3 -> /opt/python3/bin/python3*
    lrwxrwxrwx 1 root root 16 Apr 5 20:35 /usr/bin/python-config -> python2.6-config*
    root@nikos [/]#

    please tell me how to unistall python 2.6 and just keep 2.7
    and install 3.3.2 please uisng yum.

    yum install python3 doesnt work for me.
    What is now proved was once only imagined!
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Location
    Usually Japan when not on contract
    Posts
    240
    Rep Power
    12
    Looking at the output you pasted, you should not change anything. Your system depends on the python2.6 installation for all sorts of core tasks. The Python2.7 installation is local, not a part of the system search path and there is no telling what options it has been built with, so even if you replace 2.6 with 2.7, you can't know if that will break your system or not.

    A similar problem exists for Python. System-wide you should stick with whatever is provided by the CentOS repos. Locally you can build and run whatever version of Python you want, but don't mess with the system installed version -- too many system utilities depend on them to start messing around in there, especially without understanding how to manually roll your system back.

    I strongly recommend you rethink why you "need" to move from Python 3.3 to 3.2 and 2.6 to 2.7 at the system level.
  14. #8
  15. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2003
    Location
    Thessaloniki
    Posts
    1,285
    Rep Power
    13
    okey ill leave intact 2.6 but everything else i need it removed.

    i rm -rf /root/.local

    but still

    [code]
    root@nikos [/opt/python3/bin]# which python
    /usr/bin/python
    root@nikos [/opt/python3/bin]# which python3
    /usr/local/bin/python3
    root@nikos [/opt/python3/bin]# which python3.3
    /usr/local/bin/python3.3
    root@nikos [/opt/python3/bin]# ls -l /usr/bin/python*
    -rwxr-xr-x 3 root root 4864 Feb 22 02:00 /usr/bin/python*
    lrwxrwxrwx 1 root root 6 Apr 5 20:34 /usr/bin/python2 -> python*
    -rwxr-xr-x 3 root root 4864 Feb 22 02:00 /usr/bin/python2.6*
    -rwxr-xr-x 1 root root 1418 Feb 22 02:00 /usr/bin/python2.6-config*
    lrwxrwxrwx 1 root root 24 Apr 7 22:10 /usr/bin/python3 -> /opt/python3/bin/python3*
    lrwxrwxrwx 1 root root 16 Apr 5 20:35 /usr/bin/python-config -> python2.6-config*
    root@nikos [/opt/python3/bin]#
    [code]

    What is this python3 and python 3.3

    how can i wipe it clean

    and then just 'yum install latest_python' ???
    What is now proved was once only imagined!

IMN logo majestic logo threadwatch logo seochat tools logo