[英]What is the difference between running python in terminal and in IDE?
I'm new in Python. 我是Python新手。 I'm using Windows 7.
我正在使用Windows 7。
When I install pip on my computer, I need to use the installing program: get-pip.py. 在计算机上安装pip时,需要使用安装程序:get-pip.py。
I found 3 ways to run this .py file: 我发现了三种方法来运行此.py文件:
I have two questions: 我有两个问题:
The only way can install it is "1. In cmd, type "python get-pip.py". I wonder what's the difference between 1 2 and 3? 可以安装的唯一方法是“ 1.在cmd中,键入“ python get-pip.py”。我想知道1 2和3之间有什么区别?
Usually, when I double click .py file, it is usually opened by idle(default). 通常,当我双击.py文件时,通常会被闲置打开(默认)。 But this time, when I double click get-pip.py, it begins running as if a .exe file.
但是这一次,当我双击get-pip.py时,它开始像.exe文件一样开始运行。 Why?
为什么?
Thank you. 谢谢。
Answer to question 1. If you run python from within a command window (cmd) you will be able to see the output if any. 对问题1的回答。如果从命令窗口(cmd)中运行python,则将看到输出(如果有)。 As opposed to double clicking it which will run the program and close it unless the program is supposed to do otherwise.
相对于双击它会运行程序并关闭它,除非该程序本来应该这样做。 And Idle is mimicking the open command window.
空闲模拟打开的命令窗口。
One thing to watch out for is having 2 python interpreters on the system. 要注意的一件事是系统上有2个python解释器。 If you are just starting out I would avoid installing a 2nd one.
如果您只是刚开始,我会避免安装第二个。 Removing old python interpreters is as easy as removing the folder they are in. You said it "runs differently" which makes me think this is a concern.
删除旧的python解释器就像删除它们所在的文件夹一样容易。您说它“以不同的方式运行”,这使我认为这是一个问题。
Answer to question 2 You can change what program uses the file. 对问题2的答案您可以更改使用该文件的程序。 You can have idle read it, or the python interpreter run it.
您可以空闲读取它,或由python解释器运行它。 check out http://www.thewindowsclub.com/change-file-associations-windows for info on how to change that behavior.
请访问http://www.thewindowsclub.com/change-file-associations-windows,以获取有关如何更改此行为的信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.