Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
hi, i'm trying to update python on my centos distro, by typing: yum update python but yum says there are no packages that require updating, though my python version is ...
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    12

    Updating python on centos

    hi, i'm trying to update python on my centos distro, by typing:
    yum update python
    but yum says there are no packages that require updating, though my python version is 2.3
    how do i upgrade to the latest version?

  2. #2
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,344
    I wouldn't mess around with Python unless you are good at troubleshooting. Some of the package management tools require python, so if python breaks, you can be stuck without tools such as yum. If you need a newer version of python, you can compile it from source into a different prefix. CentOS is very conservative about package versions because it meant to be a stable platform, so there are only bug fixes and no new features during the lifetime of a release.

  3. #3
    Just Joined!
    Join Date
    Sep 2007
    Posts
    12
    Can you explain to me how do i do that?
    Wouldn't it be easier installing python2.5 using yum, but like you said not making it the default python interpreter to use?
    Thanks

  4. #4
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,344
    If you are building python from source, to install it into another prefix, you would do something like
    Code:
    #./configure --prefix=/path/to/some/prefix
    I usually use /usr/local/python as the installation directory. As for using yum in the manner you suggested, its possible but unfortunately most rpms are built to overwrite older versions, so the default intepreter would be the latest version because the old one will have been overwritten.

  5. #5
    Just Joined!
    Join Date
    Sep 2007
    Posts
    12
    sorry, that was too generic for me... can you give me a real example?

  6. #6
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,344
    Quote Originally Posted by noama View Post
    sorry, that was too generic for me... can you give me a real example?
    The installation documentation thats available in the python source package has more information on configuring and installing python. You may find it helpful if you look at that first and then look at the command I posted. Cheers.

  7. #7
    Just Joined!
    Join Date
    Sep 2007
    Posts
    12
    Ok, thanks, i now understand your last post completely.
    One last (stupid) question - how do i run the new python interpreter installed? typing "python' of course runs the old preinstalled 2.3 interpreter. and when i look at the bin directory under the install path there's a file named python2.5 but typing it's name causes an "illegal command" error... any ideas?

  8. #8
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,344
    You can use the full path name e.g. /usr/local/python/python.

  9. #9
    Just Joined!
    Join Date
    Sep 2007
    Posts
    12
    1. just for general knowledge, since i don't get - when i'm in the dir /usr/local/python2.5/bin/ and i type "python2.5 " i get "bash: python2.5: command not found" but when i type the full path i.e. /usr/local/python2.5/bin/python2.5 it works fine.
    2. how can i bind the keyword "python2.5" with the python2.5 interpreter, i.e that it'll work from any directory simply by typing "python2.5" and not the full path, like it works for the "python" (the 2.3 version)? do i have to add python2.5's path to PATH? As a programmer that sounds to me like bad practice, like not dividing your fnuctions and classes to namespaces in C++.

  10. #10
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,344
    You can create a symlink e.g.
    Code:
    #ln -s /usr/local/python2.5/bin/python /usr/local/bin/python2.5
    After issuing that command, you should be able to enter the command python2.5 without any command not found errors.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...