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 |
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.
|
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!
|
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" |
All times are GMT -5. The time now is 04:17 PM. |