[Tutor] upgrading Python

bhaaluu bhaaluu at gmail.com
Sat Oct 13 23:47:53 CEST 2007


Greetings,
On my system I can have several python versions installed because
they install as python2.3, python2.4, etc.

$ which python
/usr/bin/python
$ ls -l /usr/bin/python
... /usr/bin/python -> python2.4

Here, we can see that "python" is just a link to /usr/bin/python2.4
So, I can install python 2.5, and simply change the link so when I
enter "python" at the prompt, it will start python2.5.

$ man ln
ln [OPTION]... [-T] TARGET LINK_NAME   (1st form)

So, after installing python 2.5, change to /usr/bin, remove /usr/bin/python
$ cd /usr/bin
$ rm python

And now make a new link to python2.5 (you may have to be root!):
# ln -s /usr/bin/python2.5 python

If I'm not mistaken, the library files, and so forth are stored in different
directories, so installing a new version, won't corrupt an older version.
..../lib/python2.4/site-packages

See how python 2.4 is in the python2.4 directory?

If, for some reason, you want the other version, just start it with the
absolute pathname:
$ /usr/bin/python2.3

I hope this is helpful? I don't use Mandrake, so I'm unfamiliar with
its package manager, or how to do upgrades for it. The above are
generic *nix commands that should work with any distro.

apt-get and Synaptic rock! =)
-- 
b h a a l u u at g m a i l dot c o m
http://www.geocities.com/ek.bhaaluu/index.html

On 10/13/07, LandSurveyor <chiselchip at earthlink.net> wrote:
> I wish to upgrade Python from the [Vers.] 2.3.4 that came packaged with my Mandrake 10.1 Linux OS to the current 2.5.1.  The 'hash/bang' line of my python scripts is "#!/usr/bin/python".  There are two files, both executables, in my /usr/bin directory; they are 1)python, and 2)python2.3.
>
> I just simply don't know what to do next!?  The advise I can google to is typically overly generous, full of contradictions (sometime within the same post..."Well you can do this, but if you wanna do that instead...").  Well, I don't know why "I want to do this", or "do that instead".  I just want to know where to put my new version of python, and when I unzip/configure/and so on..., will I end up with:
>
> 1)an application that will pick up seamlessly and run my apps?
> 2)will pythontutor still be available?
> 3)will I have an upgraded & accessible package of modules?
> 4)will I need to modify the "hash/bang" line?
> 5)when I type 'python' on a command line, how will I access the new 2.5.1 rather than the older version?  i.e., where do I go to modify the results of that request?
>
> Oh, and could I-as I understand (to a limited degree) Linux- install the entire package within my home directory, following the principle that I am a user without admin privileges, and then change the "hash/bang" line to redirect to my 'embedded' version, and thus be running 2.5.1 within my own little world?  And if I did so, the same questions persist.  If I asked for a module, would I get the one from my 2.5.1, or the module that exists in the older 2.3.4?  And when I entered 'python' from a command line (to access the interpreter) how would I get my 2.5.1 version, rather than the older 2.3.4.
>
> It's just amazing, the array of niggling little questions that no one thinks about, but that create unmountable stumbling blocks once they pop up in the middle of your path, isn't it!?  But, they are enough to completely stop me in my tracks, and they are the nitty-gritty questions that no one seems to think important enough to address and clarify.
>
> Thanks, folks.
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list