by airstrike · 2y ago · 0 comments
I don't recall ever needing anything other than virtualenvwrapper and pip—and even some of the annoyances these tools had early on have been solved by now...
https://virtualenvwrapper.readthedocs.io/en/latest/
If you really need different versions of python, you can just `mkvirtualenv -p python3 venvname`
I feel like every other tool out there has to explain what problem they solve that virtualenvwrapper doesn't
Don't install anything globally, creates lots of envs, and feel free to have different versions of python installed side-by-side with some "main" version preferably symlinked as `python` and `python3`
The end
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
However, pyenv addresses a different problem: managing versions of Python itself.For example, if you need the latest version of Python and it is not available through your OS:
pyenv install 3.12
pyenv global 3.12 brew install python@3.8
brew install python@3.12
and pick whichever one I want symlinked as `python` and `python3` (I think the last one you install is the one that gets symlinked, but you could always change those links yourself manually)on Linux it should be just as easy to have multiple versions side-by-side
it's been a while since I've done something similar on Windows but it's also possible (although I think I would prefer to use WSL if I were on Windows these days)
This is what pyenv does.
also it's terribly named because it conflates the idea of python environments with python versions
just install pre-compiled python from official sources side-by-side. no pyenv needed
and I already have homebrew to install python (and anything else), which I trust to have more users and better formulas. other OSes have their own tools