简体   繁体   中英

What is the difference between running python in terminal and in IDE?

I'm new in Python. I'm using Windows 7.

When I install pip on my computer, I need to use the installing program: get-pip.py.

I found 3 ways to run this .py file:

  1. In cmd, type "python get-pip.py"
  2. Open it with IDLE and F5
  3. Double click get-pip.py

I have two questions:

  1. 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?

  2. Usually, when I double click .py file, it is usually opened by idle(default). But this time, when I double click get-pip.py, it begins running as if a .exe file. 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. 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. 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.

Answer to question 2 You can change what program uses the file. You can have idle read it, or the python interpreter run it. check out http://www.thewindowsclub.com/change-file-associations-windows for info on how to change that behavior.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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