Python.exe opens in a new console window

前端 未结 3 1861
感动是毒
感动是毒 2021-01-25 13:28

I used to run Python scripts from my Windows command line, and all the prints were printed in the same console. Now something happened on my machine (Windows 10), and when I lau

3条回答
  •  醉话见心
    2021-01-25 13:57

    It's odd but it very likely a windows setup issue as python is an exe. If memory serves windows will spawn on a > run command so checking the way python is booting will help.

    Unfortunately it could be a range of issues, so some steps towards victory:

    What happen when you just type python into the cmd? If it simply starts the input >>> - it means your python setup is fine. If a cmd window spawns and disappears it may be a windows permissions issue.

    Try running your script with -i flag: python -i script.py. This drops you into the repl when the app completes - displaying your output.

    Ensure you're using the native flavour of the cmd to test. Ensuring any command app or IDE isn't injecting a start command or weird /K (spawn new window) flag.

    Hope it helps.

提交回复
热议问题