
Using both Python 2 and 3 in Windows - spapas82
https://spapas.github.io/2017/12/20/python-2-3-windows/
======
johnminter
It is even easier using conda.[1] Install whichever you use the most (likely
python3) using either the full anaconda installer or the simpler miniconda
installer. Then use conda to create an environment that uses the other python
release. One has another benefit: one can create custom environments for
analyses where "dependency hell" is a common problem...

[1] [https://conda.io/docs/](https://conda.io/docs/)

------
dijit
You know what? I appreciate the authors drill-down into the "how" of this
issue but I'd like to focus on the "why".

Why, has it taken so long to get off of python2.x- noted I understand that a
few libraries _cough_ twisted _cough_ have been holding projects back that
depend on them. But I haven't wrote a single block of code in half a decade
that wasn't python 2.x and python 3.x compatible.

At what point will we exclusively be developing on 3.x? I'm quite tired of the
apologists claiming that making/maintaining things in 2.x is totally fine. At
the very least you could run a pass of `2to3` (which is generally quite mature
today) before claiming that it's difficult/impossible/too time consuming.

~~~
upofadown
It's insane to think that Python 2 is going to go away because of the
existence of Python 3. That is simply not how computer languages work. Python
2 has more than enough critical mass to continue pretty much forever in some
form. It is even a reasonable target for new development because it is pretty
much guaranteed to be stable. I would not be surprised if there was another
initiative to fix Python 2's Unicode handling that would create a fork from
Python 3 in the future as Python 3 took an approach that did not catch on.

~~~
newen
So true. Just last week I thought I would start to use python 3 because I was
starting on a new project and had a new computer. I installed anaconda python
3 only to have it crash when starting jupyter because the new python 3 version
doesn't support backtick quoting for some reason, and jupyter was using
backtick quoting.

Oh well, back to python 2 for me, which will be stable for at least 2 years.
Hopefully by then, I will be able to switch to another language.

~~~
sametmax
Jupyter doesn't use backstick quoting if you install it from Python 3.

------
ainiriand
A missing point here:

If you have an accent in your username on windows, you are welcome to a
kingdom of pain due to pip inability to process paths with non-ascii chars.

~~~
zarita_existe
On a side note, who’d put an accent on its username? Any person with minimal
programming knowledge could imagine how bad idea that is.

~~~
dagw
Computer asks you to enter your name, you enter your name, name gets used as
user name. Seems quite reasonable all around.

------
syntaxing
I get around this by installing both version of WinPython. It's super easy
since you install them into separate directories. You can double click into
the command prompt shortcut that links to the folder and use pip to your
liking for each version. Changing the interpreter in PyCharm is about two
clicks too.

------
nickjj
I think this is why Docker is so darn useful.

Once you embrace it, using Python 2.x or 3.x on Windows (or MacOS, or Linux)
involves changing 1 line in 1 file and you're pretty much done. Each app you
develop can also use whatever version you want with total isolation.

There's no Windows hoops to jump through or virtual environments to create.

------
pk78
My approach to using both py2 and py3 in windows: Use 2 folders of WinPython
(completely portable) for py2 and py3. A shell script which changes all the
necessary env vars from 2->3, 3->2\. Just double-click on the shell script
when you want to switch and you're done.

~~~
gt_
This was my earlier approach before I moved to using 3 for most things. At
that time, I tried moving env vars to 3->2 and using the Windows Launcher and
haven’t looked back. It makes everything work so much better. This article
actually does a fairly insufficient job of explaining it. The official docs on
the Windows Launcher are worth working through. Being able to use #! in my
scripts and work seamlessly with ‘py’ commands in terminal is superior in
every way.

