3 ms·
Virtual environments with venv don't answer the python version problem unless you throw another tool into the mix.
by regularfry 1y ago
Virtual environments with venv don't answer the python version problem unless you throw another tool into the mix.
- underdeserver 1y agoHmm? My venvs do include the Python version (via symlink to /bin). Don't yours?
- diggan 1y agoIf you use something like uv (expanded here: https://news.ycombinator.com/item?id=43904078 https://news.ycombinator.com/item?id=43904078), I think it does. But if you just do `python -m venv .venv`, you get the specific version you used to create the virtual environment with. Some OSes seem to distribute binaries like `python3.8`, `python3.9` and so on so you could do `python3.8 -m venv .venv` to look one env to a specific version, but a bit of a hassle.
- regularfry 1y agoThe GP's problem was (apparently) an inability to install the right python version, not an inability to select it.
- laborcontract 1y agouv solves this problem. uv venv python3.11 done.
- homeless_engi 1y agoConda does! `conda create -n myenv python=3.9`, for example
- krferriter 1y agoconda and uv do manage python versions for you which is part of their appeal, especially on systems that don't make it super straightforward to install multiple different versions of pre-compiled runtimes because their official OS channel of installing python only offers one version. At least on macos, brew supports a number of recent versions that can be installed simultaneously.