TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Using both Python 2 and 3 in Windows

42 pointsby spapas82over 7 years ago

6 comments

johnminterover 7 years ago
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 &quot;dependency hell&quot; is a common problem...<p>[1] <a href="https:&#x2F;&#x2F;conda.io&#x2F;docs&#x2F;" rel="nofollow">https:&#x2F;&#x2F;conda.io&#x2F;docs&#x2F;</a>
dijitover 7 years ago
You know what? I appreciate the authors drill-down into the &quot;how&quot; of this issue but I&#x27;d like to focus on the &quot;why&quot;.<p>Why, has it taken so long to get off of python2.x- noted I understand that a few libraries <i>cough</i>twisted<i>cough</i> have been holding projects back that depend on them. But I haven&#x27;t wrote a single block of code in half a decade that wasn&#x27;t python 2.x and python 3.x compatible.<p>At what point will we exclusively be developing on 3.x? I&#x27;m quite tired of the apologists claiming that making&#x2F;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&#x27;s difficult&#x2F;impossible&#x2F;too time consuming.
评论 #15969430 未加载
评论 #15969219 未加载
评论 #15968952 未加载
评论 #15969103 未加载
评论 #15969986 未加载
评论 #15969863 未加载
ainiriandover 7 years ago
A missing point here:<p>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.
评论 #15970169 未加载
评论 #15969239 未加载
评论 #15969440 未加载
评论 #15970015 未加载
syntaxingover 7 years ago
I get around this by installing both version of WinPython. It&#x27;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.
nickjjover 7 years ago
I think this is why Docker is so darn useful.<p>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&#x27;re pretty much done. Each app you develop can also use whatever version you want with total isolation.<p>There&#x27;s no Windows hoops to jump through or virtual environments to create.
pk78over 7 years ago
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-&gt;3, 3-&gt;2. Just double-click on the shell script when you want to switch and you&#x27;re done.
评论 #15972907 未加载