Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

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

Writer Andrew Henderson

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.

4

2 Answers

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().

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy