Live data from Hacker News

Pyenv – lets you easily switch between multiple versions of Python

github.com

191–200 of 341 posts

Re: Pyenv – lets you easily switch between multiple versions of Python

#191

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/ If you really need different versions of python, you can just `mkvirtualenv -p python3 venvname` I feel like every other tool out…

You 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!

Re: Pyenv – lets you easily switch between multiple versions of Python

#192

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/ If you really need different versions of python, you can just `mkvirtualenv -p python3 venvname` I feel like every other tool out…

You 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.

Re: Pyenv – lets you easily switch between multiple versions of Python

#193

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/ If you really need different versions of python, you can just `mkvirtualenv -p python3 venvname` I feel like every other tool out…

Glad 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.

Re: Pyenv – lets you easily switch between multiple versions of Python

#194

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/ If you really need different versions of python, you can just `mkvirtualenv -p python3 venvname` I feel like every other tool out…

You 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!

Agreed, but `workon` is too convenient not to have

Re: Pyenv – lets you easily switch between multiple versions of Python

#195

Tools you can use to make sure the Python program you wrote keeps working: requirements.txt, pip, pipenv, pyenv, virtualenv, pyenv-virtualenv, virtualenvwrapper, pyenv-virtualenvwrapper, venv, pyvenv, conda, miniconda, poetry, docker, nix. Which ones did I miss? Which of them actually ensure your program always works the same as when you first wrote it, without asterisks?

What package managers are people using in other languages to make sure that software "always works the same as when you first wrote it, without asterisks"? I'd like to understand how they solve the "package no longer exists in a central registry" problem.

I think you're referring to vendoring dependencies? In python/pip for example, you can download the source for a package and point to the folder directly as a dependency instead of the version or a git URL. Most package managers/languages support some version of that. I suppose if you wanted to vendor all dependencies by default, keep them updated etc it would take a little more scripting or extra tools.

Re: Pyenv – lets you easily switch between multiple versions of Python

#196

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/ If you really need different versions of python, you can just `mkvirtualenv -p python3 venvname` I feel like every other tool out…

For 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

Re: Pyenv – lets you easily switch between multiple versions of Python

#197

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/ If you really need different versions of python, you can just `mkvirtualenv -p python3 venvname` I feel like every other tool out…

> 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.

Re: Pyenv – lets you easily switch between multiple versions of Python

#198

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/ If you really need different versions of python, you can just `mkvirtualenv -p python3 venvname` I feel like every other tool out…

For 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

on 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)

Re: Pyenv – lets you easily switch between multiple versions of Python

#199

Tools you can use to make sure the Python program you wrote keeps working: requirements.txt, pip, pipenv, pyenv, virtualenv, pyenv-virtualenv, virtualenvwrapper, pyenv-virtualenvwrapper, venv, pyvenv, conda, miniconda, poetry, docker, nix. Which ones did I miss? Which of them actually ensure your program always works the same as when you first wrote it, without asterisks?

[deleted]

Re: Pyenv – lets you easily switch between multiple versions of Python

#200

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/ If you really need different versions of python, you can just `mkvirtualenv -p python3 venvname` I feel like every other tool out…

> 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.

by 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

Post reply on HN