How to keep a Python script output window open?

前端 未结 23 2816
挽巷
挽巷 2020-11-22 10:54

I have just started with Python. When I execute a python script file on Windows, the output window appears but instantaneously goes away. I need it to stay there so I can an

23条回答
  •  深忆病人
    2020-11-22 11:17

    1. Go here and download and install Notepad++
    2. Go here and download and install Python 2.7 not 3.
    3. Start, Run Powershell. Enter the following. [Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27", "User")
    4. Close Powershell and reopen it.
    5. Make a directory for your programs. mkdir scripts
    6. Open that directory cd scripts
    7. In Notepad++, in a new file type: print "hello world"
    8. Save the file as hello.py
    9. Go back to powershell and make sure you are in the right directory by typing dir. You should see your file hello.py there.
    10. At the Powershell prompt type: python hello.py

提交回复
热议问题