TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Using both Python 2 and 3 in Windows

42 点作者 spapas82超过 7 年前

6 条评论

johnminter超过 7 年前
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>
dijit超过 7 年前
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 未加载
ainiriand超过 7 年前
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 未加载
syntaxing超过 7 年前
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.
nickjj超过 7 年前
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.
pk78超过 7 年前
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 未加载