3 ms·
I've been using python on and off since Django 0.96, which was released in 2007. I don't recall ever needing anything other than virtualenvwrapper and pip—and
by airstrike 3y ago
I've been using python on and off since Django 0.96, which was released in 2007.
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/ 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
- packetlost 3y agoYou don't even need virtualenv much less virtualenv wrapper. On Debian/Ubuntu distros (and most others, with small modifications) you just need python3-venv. Then create your venv with `python3 -m venv myenv` or `python3.11 -m venv my311venv` or whatever version of Python you need. Less is more!
- cgopalan 3y agoYou should look at the command `python -m venv`. Its built in, and is a breeze to create virtual environments. I guess it does not provide shortcuts for activation etc, but I am ok with that.
- stairlane 3y agoGlad I’m not the only one. As soon as I started using Pyenv for local development I bloated my machine with more versions of python than I could manage. Obviously user error, but it never solved a problem I couldn’t get around with virtualenv.
- divbzero 3y agoFor managing versions of Python packages, I take a similar route and keep it simple: 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
- airstrike 3y agoon Mac OS I just do 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)
- divbzero 3y agoSome Linux distros don’t have the latest Python versions in their package repos, but there are definitely other ways to install versions side-by-side.
- rovr138 3y ago> feel free to have different versions of python installed side-by-side with some "main" version preferably symlinked as `python` and `python3` This is what pyenv does.
- airstrike 3y agoby compiling from source? god no. 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
- rovr138 3y agoBut that’s the point of the tool. Let it manage that for you.
- airstrike 3y agoright, but now you know even less about your setup when you some roadblock. and compiling python from source is very slow and error prone because it requires a bunch of flags and other libraries to be available. I have no problem compiling stuff from source generally, but python specifically is a major PITA 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
- rovr138 3y ago> right, but now you know even less about your setup when you some roadblock This is the same with a binary though. And with homebrew, you can't follow patches or flags used or if they change. - https://github.com/Homebrew/homebrew-core/blob/c964ad7fa53ade9b665c91a601bdb4b9cd19d8d2/Formula/p/python%403.12.rb#L139-L151 https://github.com/Homebrew/homebrew-core/blob/c964ad7fa53ad... - https://github.com/Homebrew/homebrew-core/blob/c964ad7fa53ade9b665c91a601bdb4b9cd19d8d2/Formula/p/python%403.12.rb#L91-L97 https://github.com/Homebrew/homebrew-core/blob/c964ad7fa53ad... - https://github.com/Homebrew/homebrew-core/blob/c964ad7fa53ade9b665c91a601bdb4b9cd19d8d2/Formula/p/python%403.12.rb#L305-L308 https://github.com/Homebrew/homebrew-core/blob/c964ad7fa53ad... Not arguing for good or bad, just saying that the problem isn't limited to this.