4 ms·
Why did you want to `brew install virtualenv`? That’s no longer the current way to work with python. Virtual environments are now in the standard library: p
by da39a3ee 5y ago
Why did you want to `brew install virtualenv`? That’s no longer the current way to work with python. Virtual environments are now in the standard library:
python -m venv /my/directory
I’ve never had any problem with homebrew in over a decade’s usage. But yes, don’t use it for python development tooling: use pyenv and python -m venv and pip for that.
- kortex 5y agoI can't recommend pyenv and pipx enough. I use brew to install pyenv and pipx, and there ends my interaction with brew and python. Pyenv builds all of my python versions. Pipx installs cli tools in their own env. Precommit is also great for much more than just pre-commit hooks. It can install tools used for hooks in their own cache, no need to manage venvs yourself.
- rbanffy 5y agoPyenv will setup Python environments under your user and replace the system Python executable with a shim. Depending on your setup, it can create a lot of confusion (I have fixed a lot of colleague machines in the past year that were broken in one way or another). Doing a `python[V.v] -m venv …` and then sourcing `activate` is conceptually much simpler and doesn’t affect any other terminal sessions you may have open.
- Brian_K_White 5y agoMe 11 minutes from now: "why did you use venv? They replaced that 11 minutes ago with ..."
- da39a3ee 5y agoNo. If you’re not an experienced python programmer then I can see that your comment might seem like a witty contribution. But I was actually providing good advice.
- Brian_K_White 5y agoIf you're not an experienced /anything/ then I can see how that comment might have seemed like a personal attack, but I was actually only providing an observation, from someone who's been around longer than "11 minutes", about python and the rate at which it and other similar entire systems and their library of best practices changes, dickface.
- n8henrie 5y agoAbsolutely. Brew manages pyenv, pyenv manages Python versions, venv manages Python packages / projects. Has been very reliable for the last decade or so, with my only complaint being the need for special linker flags when installing a new Python (homebrew openssl path etc), esp if doing an `--enable-optimizations` build (which I definitely recommend in the long run). brew install pyenv pyenv install 3.9.7 cd ~/myproject pyenv local 3.9.7 python3.9 -m venv --upgrade-deps .venv source ./.venv/bin/activate You're off to the races. (I think I got that --upgrade-deps flag right.)