简体   繁体   English

在同一台PC上管理两个版本的Python

[英]Managing two versions of Python on the same PC

I have a Windows PC and am running Python 3.4 for some time with all my code using this version. 我有一台Windows PC,并且运行Python 3.4已经有一段时间了,所有代码都使用这个版本。 C:\\Python34 and C:\\Python34\\Scripts are on my search path. C:\\Python34C:\\Python34\\Scripts在我的搜索路径上。

I want to use Google App Engine now but it seems that I will have to install Python 2.7. 我现在想使用Google App Engine,但似乎我必须安装Python 2.7。

I have no problems managing both versions manually for my own programs. 对于我自己的程序,我手动管理这两个版本都没有问题。 But how about applications that run behind my back or under the covers, eg GAE, pip, etc? 但是如何在我的背后或幕后运行的应用程序,例如GAE,pip等? How would they know which or where the correct version will be? 他们如何知道哪个或哪个版本正确?

Specifically, for GAE, can I continue to have Python 3.4 as the one with the option "Make this the Python installation the default Python installation" ? 具体来说,对于GAE,我可以继续使用Python 3.4作为选项"Make this the Python installation the default Python installation"吗?

For this purpose exists a "virtualenv" tool alias virtual enviroment. 为此目的,存在一个“virtualenv”工具别名虚拟环境。 More HERE . 更多HERE

In short, you create a container (folder/enviroment) "A" with version 2.X and another container "B" with version 3.X and inside these containers will be all scripts executed by appropriate python interpreter which you have selected during creating these containers. 简而言之,您创建一个版本为2.X的容器(文件夹/环境)“A”和版本3.X的另一个容器“B”,这些容器内部将是您在创建过程中选择的相应python解释器执行的所有脚本这些容器。

Official documentation of virtualenv is aimed to UNIX/Linux systems, so for you as WIN's user might be better (easier) to use "virtualenvwrapper-win". virtualenv的官方文档针对的是UNIX / Linux系统,因此对于WIN来说,WIN的用户可能会更好(更容易)使用“virtualenvwrapper-win”。 More HERE 更多HERE

Change the Paths in system control panel Or set PATH value in cmd line before running 3PP programs 在运行3PP程序之前,在系统控制面板中更改路径或在cmd行中设置PATH值

路径

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM