Unbreaking Python Through Virtual Environments

I wrote some days ago a post “Getting Started With Python Right!“. In this post I wrote about what I’d found to be the best way to setup MacOS for Python development. In it I also added links and a few details to get a Windows or Linux machine setup right for Python development.

However, there’s more, as¬†@tlockney (Thomas Lockney)¬†pointed out in a comment! He detailed,

  1. Since you’re using pyenv, the version of pip you use should always be the one associated with the current version of Python, which won’t be the case when you later switch versions.
  2. People who aren’t clear on what’s going on will likely copy the code you included verbatim, so instead of aliasing the version of pip referenced in the pyenv path, it’s going to always point at the brew installed version.
  3. You really should use virtualenv for pretty much everything and try to avoid ever installing libraries into your global Python environment. If you need tools accessible outside a virtualenv, check out pipx.

Continue reading “Unbreaking Python Through Virtual Environments”