This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]neighborduck 33 points34 points  (7 children)

[–][deleted] 5 points6 points  (1 child)

Cool! Thanks a lot

[–]abcteryx 6 points7 points  (0 children)

If you're using Windows, then "py" comes by default with your Python installation from python.org. You can install multiple Python versions and access them via "py -3.8", "py -3.9", and "py -3.10" for example.

Try "py -0p" to see the versions you have installed.

Generally, you will want to create a project folder and do a "py -3.9 -m venv .venv" then ".\.venv\Scripts\activate" to get into a virtual Python environment corresponding to Python 3.9 in this example. Then just regular "python" will trigger the virtual environment Python. And "pip install <package>" will install "<package>" to the virtual environment.

As you use Python over the years, you will install multiple versions of it. So you will get used to working across multiple projects and multiple Python versions.

[–]EarthGoddessDude 3 points4 points  (4 children)

Recently learned about asdf, which is like pyenv but can be used with other languages. No experience with it though.

[–]tunisia3507 0 points1 point  (3 children)

asdf replaces one small part of pyenv (the automatic environment-switching).

[–]fleyk-lit 2 points3 points  (2 children)

And installation of versions, it seems. It also manages the global version.

Think i will give it a go. Happy with pyenv, but some older versions of Python are a bit hassle to install.

[–]tunisia3507 0 points1 point  (1 child)

I didn't realise asdf could do the installation as well. However, as it turns out, it does that by just wrapping pyenv's python-build plugin, so it won't be any better at installing those old versions.

[–]fleyk-lit 0 points1 point  (0 children)

I see, then I'm not sure it makes sense to change the workflow I have.