I can't exit out of python on CMD using ctrl + c

When I was trying python on cmd prompt and I was trying to exit to install a package, the sentence "keyboard interrupt" was displayed instead of actually exiting. I couldn't find a "break" key to try ctrl + break, so I kept trying with ctrl + c. I tried the default settings, removing the quick edit mode, and run as administrator, I just can't seem to exit out of python.

Any help with this problem would be much appreciated.


On Windows, in the interactive Python interpreter, the options to exit are:

  • quit()

  • exit()

  • Ctrl + Z then Enter

  • Ctrl + Break

When running scripts, Ctrl + C can generally be used to send a KeyboardInterrupt that halts script execution (note that a Traceback will be generated).


The Ctrl + Break option assumes your keyboard has a Break or Pause/Break key.


Due to a design decision, the Python interpeter does not exit on Ctrl+C,
but rather on Ctrl+D or the command exit().