简体   繁体   中英

Is there a way that command prompt could run a python file from Visual Code Studio?

I was wondering if there is a way the command prompt could run a python file when I click the run button on visual code studio. Is that possible? Thanks in advance.

Yes, that is possible (in fact, a lot of developers and learners do this) and it can be done by following these steps:-

  • Download and install Python on your system and add the bin folder to the path, environment variables.
  • Install Code Runner Extension from Extension tab in VSCode
  • Set the configuration of terminal in VSCode to Python
  • Ctrl+Shift+N is the hotkey to run the Python program in terminal in VSCode.

All you do is enter this into command prompt: PATH OF FILE . For example, if my file was hello.py in Documents, then I would type in C:/Documents/hello.py

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