LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-11-2012, 08:11 AM   #1
shiju2215
LQ Newbie
 
Registered: Oct 2006
Posts: 3

Rep: Reputation: 0
Unhappy How to point a command to use new version of application


Hi,
I am new to Linux and need some help with commands:

I installed multiple versions of python in my CentOS host.

[root@test bin]# python (if I hit tab these are what I see)
python python2 python2.4 python3.2 python3.2m python3.2m-config

[root@test bin]# python -V
Python 2.4.3

[root@test bin]# python2.4 -V
Python 2.4.3

[root@test bin]# which python
/usr/bin/python

[root@test bin]# which python2.4
/usr/bin/python2.4

[root@test bin]# which python3.2
/usr/local/bin/python3.2


Now this is what I want ….
I want all versions to be there in the host.
When someone just runs the command (# python -V), the server should be using the application “python3.2” instead of “python2.4”

What is the best way to achieve it so that the command “python” uses “python3.2” instead of “python2.4”?

I tried doing the following as the root user:
#mv /usr/bin/python /usr/bin/python.bak
#alias python=/usr/local/bin/python3.2

Now the issue is that when I login using a normal linux user account, the command “python –V” gives an error: -bash: python: command not found

Any efficient way to make it work??


Thanks,
Shiju
 
Old 04-11-2012, 08:15 AM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,130
Blog Entries: 2

Rep: Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825
I would not recommend to do that. Python 2 and Python 3 are not compatible. Many tools that rely on Python are still written for Python 2. If you point all applications that are using Python to Python 3 you will most likely break the system.
 
Old 04-11-2012, 09:17 AM   #3
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
ls -l /usr/bin/python* will give you some information. /usr/bin/python is probably a symbolic link to pythonX.Y, you can change the link. As it was stated python 2 and python 3 are not compatible, so be careful!
 
Old 04-12-2012, 02:38 AM   #4
shiju2215
LQ Newbie
 
Registered: Oct 2006
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks TobiSGD, pan64

Thanks for reminding me about the compatibility issue between version 2 and 3.
You are right ... I should be careful since there could be other applications/services using "python2.x", that calls "python2.x" using the command just "python".

But I can confirmed that "python" is not a symbolic link to "python2.x". Then I do a "file python" is says its a "ELF 64-bit LSB executable"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Application no working on mount point mjeet0612 Linux - Virtualization and Cloud 1 11-02-2010 05:41 AM
Required a POS (point of sale) application which is design for auto parts... shahg_shahg Linux - Software 1 10-11-2008 08:04 PM
Installing the same application but in different version kampret77 Linux - Newbie 2 04-26-2006 11:30 AM
How can I see the version # of an application? bad_andy Linux - Newbie 1 10-24-2004 12:25 PM
point out the problem with this command bahadur Linux - Newbie 2 07-26-2004 12:50 PM


All times are GMT -5. The time now is 03:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration