Python:如果默认值为3.4,如何访问3.3? [英] Python: how to access 3.3 if 3.4 is the default?
问题描述
已安装Windows 7、2.7、3.3和3.4.
Running Windows 7. 2.7, 3.3 and 3.4 installed.
我刚刚为最近的项目安装了Python 3.3.在命令提示符下,python
启动3.4,而py
启动3.3.我可以使用3.3版本的IDLE访问3.3,但是如何通过命令提示符访问它?
我可以使用像py
这样的快捷方式吗?我是否需要像别名一样自己定义它?
还是以某种方式将路径临时更改为 将3.3设置为默认值的最佳途径?
I just installed Python 3.3 for a recent project. In the command prompt, python
launches 3.4, and py
launches 3.3. I can access 3.3 using the 3.3 version of IDLE, but how can I access it via the command prompt?
Is there a shortcut like py
that I can use? Do I need to define this on my own like an alias?
Or is the best route to somehow change the path to temporarily make 3.3 the default?
只需下载virtualenv,也许这可能是解决方案的一部分.
Just downloaded virtualenv, maybe that might be part of the solution.
推荐答案
要制作它,以便您可以从命令提示符运行不同版本的Python,请进入C:\Python33
和C:\Python34
并制作python33.exe
和python34.exe
,然后就可以运行
To make it so you can run the different versions of Python from the command prompt, go into C:\Python33
and C:\Python34
and make copies of the python.exe
that resides there. Rename the copy to python33.exe
and python34.exe
, respectively, then you can just run
python33 file.py
或
python34 file.py
在命令提示符下输入
,您将确信将使用正确的版本.我还要在C:\Python27
中复制python.exe
并将其命名为python2.exe
,只是这样,如果您不记得
from the command prompt, and you'll be assured the correct version will be used. I'd also make a copy of the python.exe
in C:\Python27
and name it python2.exe
, just so you can specify that version when needed, if you don't remember the search order of your Python directories in your PATH
environment variable.
这篇关于Python:如果默认值为3.4,如何访问3.3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!