I like Ruby, but I don’t like its performance, so I’m really anticipating Ruby 2.0. Meanwhile, I’ve been dabbling in Python. Learning a new language and comparing and contrasting them, really helps with determining each language’s strengths and weaknesses. For example, you can easily update all your Ruby gems. Unfortunately, python doesn’t have a direct way of doing this using easy_install. Very odd. I tried using the shell script method, but for whatever reason it just didn’t work as advertised. So I wrote a bash alias to take care of it.
alias easy_install_upgrade_all='python -c "for dist in __import__('\''pkg_resources'\'').working_set: print dist.project_name" | while read package; do sudo easy_install -U "${package}" ; done'
Put that alias in your ~/.bash_aliases
file, run exec bash
, and you should be good to go (assuming your .bashrc
file is setup to automatically load your .bash_aliases
file). Note the use of escaped single-quotes around “pkg_resources”.
Thanks for this tip, it’s very handy!