my OS (Ubuntu 14.04) uses an older version 2.7.6 of Python as /usr/bin/python which points to /usr/bin/python2.7 I installed a new version 2.7.9 of python as /usr/local/bin/python2.7. In my own shell, how can I make all python scripts with shebang to use the new python? Does use #!/usr/bin/env python as shebang solve the problem? How shall I make it work?Can I also make the command python be the new one?while letting my OS still use its original older one?
How can I set up using a different version of Python from the OS?
software installation;python
To set things up so that python gets you the new version but everyone else, including the standard OS programs, will get the original:choose a directory to hold your personal programs (or symlinks to them).  This could be $HOME/bin or /usr/local/bin, whatever you like. Create it if it doesn't exist. I'll use $HOME/bin in this example.Edit your ~/.profile. On Ubuntu 14.04, it likely already contains a line that says PATH=$HOME/bin:$PATH, which will put this directory at the front of your search path. If not, add that line.run ln -s /usr/local/bin/python2.7 $HOME/bin/pythonlogout, login, type which python to verify that the shell is finding the (symlink) python in your $HOME/bin directory. Type python --version to verify that you're getting the new version.You're already doing a good thing by having your scripts start with the line #!/usr/bin/env python rather than #!/usr/bin/python. The env command will look through your search path to find python.