Setting Python by default to a different version installed on a shared host

I am on a shared host and cannot change the symlink to Python2.4, it defaults to 2.3. I tried to create a sim link in the director which I will be working on until 2.4, but it seems the "global" python interpreter in / usr / bin / python accepts presedence if I don't run it like. / python. What are some alternative ways to override this behavior?

+1


source to share


2 answers


Create a symbolic link and add the path to your PATH variable:



ln -s /usr/bin/python2.4 $HOME/bin/python
export PATH="$HOME/bin:$PATH"

      

+2


source


If you are working with a shell you can create a symlink as suggested and update your path in the .profile. This is described in the previous post.

In case it is CGI / any scripts that you only use on your shared host, you can change the shebang line at the top of your scripts that tell the system which interpreter is running the script from.

those. change



#!/usr/bin/env python

      

to

#!/whatever/the/path/to/your/version/python

      

+3


source







All Articles