What are the techniques for upgrading scripting languages on Lion OS X
Don't overwrite or remove the system versions. Future OS X updates will break things.

MacPorts, Fink and Homebrew will use prefixes to prevent such problems, and typically set up the path so that your own calls to scripting languages will use their custom versions, whereas OS X packages will continue to use its own versions.