[Tutor] upgrading Python

LandSurveyor chiselchip at earthlink.net
Sun Oct 14 18:34:37 CEST 2007


Thanks for the 'meaty' response.  Therein was the nitty-gritty I could actually use.  Learned a bunch too...had never used a link before.  Didn't know why I would want to.  BTW, I met with HUGE success!

Anyway...my approach was to take the road of a user (with my own '/home' account, and no SU privileges.  That only went so far.  I installed the new Python (2.5.1) in a directory within my home that I called, incisively, '/usrlowell'.  Therein I opened up the .tgz file, and got as far as 'make', when it required me to have SU privileges (so much for the theory that I could do all I wished within my own 'world').  That speed bump has undermined a number of concepts I thought I'd figured out-regarding autonomy for a user-so I don't know now what I don't know.).

Long and the short of it, the 'make' and 'make install' continued in the /usr/bin environ (i.e., departed from my '/home' directories).  I did not at first 'rm' the /usr/bin/python file-was too nervous to try it!  What I did, though was go into my new dedicated /home/usrlowell/'newPythonPlace' directory, and found another file named 'python*'.  On command line I entered ./python, and sure enough I got python 2.5.1.  Wow!  Then I went back to /usr/bin, erased the 'python' file, created a link to my dedicated (/home/etc...etc) file, and sure enough, "which python" continues to yield /usr/bin/python, but "python" brings up the new 2.5.1.

The experience has shaken some of my established ideas of how Linux works, but it's been a great leap forward for me (as someone once said, "Do that which you are afraid to do").

Thanks for all the help.   BTW, I think-with this post-I've figured out how to correctly reply within this tutor envronment.  I THINK!?

-----Original Message-----
>From: bhaaluu <bhaaluu at gmail.com>
>Sent: Oct 13, 2007 5:47 PM
>To: LandSurveyor <chiselchip at earthlink.net>
>Cc: tutor at python.org
>Subject: Re: [Tutor] upgrading Python
>
>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