|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
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?
|
|
#2
|
||||
|
||||
|
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. |
|
#3
|
||||
|
||||
|
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. |
|
#4
|
||||
|
||||
|
Quote:
that's actually exactly what i was asking.... Quote:
ok... but how? |
|
#5
|
||||
|
||||
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. |
|
#6
|
|||
|
|||
|
Perhaps a better question is why you even bother having 1.5 installed ... it's very very very outdated.
|
|
#7
|
|||
|
|||
|
it was pre installed...
|
|
#8
|
|||
|
|||
|
If you don't need it, why keep it?
|
|
#9
|
|||
|
|||
|
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:
|
|
#10
|
||||
|
||||
|
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 Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month |
|
#11
|
|||
|
|||
|
thank you Scorpions4ever
|
|
#12
|
|||
|
|||
|
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.
|
|
#13
|
||||
|
||||
|
Quote:
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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > ok... got an easy question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|