Most of the examples people are writing DON'T WORK! (Examples have been removed.) jQuery().jquery returns the jQuery version:
$("script[src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js']")
.attr("src","http://code.jquery.com/jquery-1.7.1.js");
console.log(jQuery().jquery);
This writes 1.3.2 to the console. Just changing the src of a script doesn't make the new script actually run! Even if you give the new script chance to load with a setTimeout or load event, it still won't change the version.
You could load the script as an AJAX query and eval it.
jQuery.getScript("http://code.jquery.com/jquery-1.7.1.js");
But even that might not produce the result you expect. Any reference to jQuery or $ further down the page will have already pointed to the old jQuery object (version 1.3.2), not the new one. So to use 1.7.2, you'd then have to eval all your scripts only after getting and evaling the new script. So you're gonna have to find another way I'm afraid.
Edit: I suppose you could do this:
jQuery.getScript("http://code.jquery.com/jquery-1.7.1.js", function () {
// Only after jQuery has run
jQuery.getScript('my-script-which-depends-on-1.7.js');
});
but it's a bit cumbersome.