简体   繁体   中英

How do we run a Python script in Atom editor?

How do we run a Python script in Atom editor? Please see screenshot below with errors: Below I was testing if i can run python in Atom editor. I have also ran the ( c:\\Anaconda3\\Scripts\\activate base )command in Anaconda prompt

In your Atom built-in terminal, you are first typing in "python" without any file arguments, and such bringing you into the Python Interactive Prompt, include the name of your file (num.py).

The SyntaxError you're getting is because your trying to run "python num.py" as code instead of a CMD command.

In addition to @HarryKearney answer, there are a number of packages that will easily run scripts. For example, run-in-terminal allows you to press F5 to open a terminal or command prompt window running the python script. Some other options to do similar things are: atom-python-run , atom-runner , script to run code directly in atom and several others you can find in the package repository . Choosing one of these and installing it will probably make it a lot easy if you will be running python scripts frequently.

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