Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 27th, 2003, 11:12 PM
Caelestis Caelestis is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 6 Caelestis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Caelestis
ok... got an easy question

ok installed the newest version of python on my linux box and the shebang line (#!/usr/bin/env python) is still executing the old version of python (1.5) how can i change /usr/bin/env so that it executes the correct version?

Reply With Quote
  #2  
Old September 28th, 2003, 02:17 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,537 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 17 m 47 sec
Reputation Power: 68
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
If you type "which python" do you get the path to the old version? All you have to do is update the environment variable which points at Python (don't ask me how ), if this doesn't work you could always use the full path instead of "#!/usr/bin/env python"

Mark.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
  #3  
Old September 28th, 2003, 04:47 AM
telex4's Avatar
telex4 telex4 is offline
Wacky hack
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2001
Location: London, England
Posts: 513 telex4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 38 m 37 sec
Reputation Power: 13
env doesn't actually use an environment variable for executables like Python, AFAIK. It looks for the first "python" it can find in yout PATH variable. So you need to do something like this:

Code:
tom@piglet tom $ which python | xargs ls -l
lrwxrwxrwx    1 root     root            7 Sep 14 01:48 /usr/bin/python -> python2
tom@piglet tom $ ls -l /usr/bin/python2
lrwxrwxrwx    1 root     root            9 Sep 14 01:48 /usr/bin/python2 -> python2.2
tom@piglet tom $ ls -l /usr/bin/python2.2
-rwxr-xr-x    1 root     root       883192 Sep 14 01:48 /usr/bin/python2.2


Then you can track down the location of your new Python binary, and change any symlinks to point to the right one.

Reply With Quote
  #4  
Old September 28th, 2003, 06:47 AM
Caelestis Caelestis is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 6 Caelestis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Caelestis
Quote:
Originally posted by netytan
All you have to do is update the environment variable which points at Python (don't ask me how )

Mark.


that's actually exactly what i was asking....





Quote:
Originally posted by telex4


Then you can track down the location of your new Python binary, and change any symlinks to point to the right one.


ok... but how?

Reply With Quote
  #5  
Old September 28th, 2003, 09:09 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,537 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 17 m 47 sec
Reputation Power: 68
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
i'm kinda new to *nix so i have NO idea. You might get a better responce from the Linux forum? or just hang around for Telex to come back , i think he'll be able to answer your question better than i can.. plus i'd be interested in the answer.

Mark.

Reply With Quote
  #6  
Old September 29th, 2003, 09:19 AM
Strike Strike is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: Houston, TX
Posts: 383 Strike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 27 sec
Reputation Power: 12
Send a message via ICQ to Strike Send a message via AIM to Strike Send a message via Yahoo to Strike
Perhaps a better question is why you even bother having 1.5 installed ... it's very very very outdated.

Reply With Quote
  #7  
Old September 29th, 2003, 03:58 PM
Caelestis Caelestis is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 6 Caelestis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Caelestis
it was pre installed...

Reply With Quote
  #8  
Old September 29th, 2003, 04:01 PM
Strike Strike is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: Houston, TX
Posts: 383 Strike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 27 sec
Reputation Power: 12
Send a message via ICQ to Strike Send a message via AIM to Strike Send a message via Yahoo to Strike
If you don't need it, why keep it?

Reply With Quote
  #9  
Old September 29th, 2003, 05:59 PM
sissy sissy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 29 sissy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 48 m 25 sec
Reputation Power: 0
sounds like to me you didnt install it from the ports.

if i was you i would deinstall all versions of python, do a ports update then install from ports AND better still install portupgrade and learn it


Quote:
Originally posted by Strike
Perhaps a better question is why you even bother having 1.5 installed ... it's very very very outdated.

Reply With Quote
  #10  
Old September 29th, 2003, 07:54 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,390 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 1 Day 22 h 32 m 40 sec
Reputation Power: 4080
echo $PATH

That should print your current path variable. To append a new value to the beginning, you should do something like this (assuming a bash shell, which is default for RedHat):

export PATH=/new/path:${PATH}

basically ${PATH} will pull the old path into the expression. Now if you put the above line into your .bashrc file, then it should be set every time you log in. HTH
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

Reply With Quote
  #11  
Old September 29th, 2003, 11:08 PM
Caelestis Caelestis is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 6 Caelestis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Caelestis
thank you Scorpions4ever

Reply With Quote
  #12  
Old September 29th, 2003, 11:59 PM
Strike Strike is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: Houston, TX
Posts: 383 Strike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 27 sec
Reputation Power: 12
Send a message via ICQ to Strike Send a message via AIM to Strike Send a message via Yahoo to Strike
sissy ... ports? He said it was a Linux machine. The only port-like thing that I am familiar with there would be portage ... and you wouldn't use portupgrade with that.

Reply With Quote
  #13  
Old September 30th, 2003, 03:51 AM
telex4's Avatar
telex4 telex4 is offline
Wacky hack
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2001
Location: London, England
Posts: 513 telex4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 38 m 37 sec
Reputation Power: 13
Quote:
Originally posted by Caelestis

ok... but how?


Oops, sorry, I should have said.

First, you need to remove the old symlink (assuming it was a symlink, which you should have determined by doing what I said above... if /usr/bin/python seems to point to something, then it is a symlink (a symbolic link, like a windows shortcut)).

Then, you need to create a new symlink that will point to the location of the new python binary. You'll need to find that binary first too.

Lots to do


(find the new python binary)

Code:
ls /usr/bin/python*


(that will give you a list of binaries that begin with "python", which should include something like "python2.2")


(remove the old symlink)

Code:
rm /usr/bin/python



(make the new symlink)

Code:
ln -s /usr/bin/python2.2 /usr/bin/python


(where "/usr/bin/python2.2" is the path to your new python binary)



I hope that helps. If you're still confused, feel free to ask for more help You might also want to learn a little about the basics of UNIX and GNU/Linux if you're going to be doing a lot of Python coding; or you may not If you do, try www.NewToLinux.org.uk

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > ok... got an easy question

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap