How to Configure Atom to Run Python3 Scripts

How to configure Atom to run Python3 scripts?

Go to the Atom's menu bar -> Packages -> Script -> Configure Script
(Or, you can use the shortcut Shift+Ctrl+Alt+O)

Then type python3 to the Command space.
Hopefully, it will work.

How to setup Atom's script to run Python 3.x scripts? May the combination with Windows 7 Pro x64 be the issue?

This can be easily solved by editing the /home/.atom/packages/script/lib/grammars.coffee file (note that the atom folder is hidden so you might have to press ctrl+H to view hidden files and folders)

Inside grammars.coffee find:

  Python:
"Selection Based":
command: "python"
args: (context) -> ['-u', '-c', context.getCode()]
"File Based":
command: "python"
args: (context) -> ['-u', context.filepath]

and replace with:

  Python:
"Selection Based":
command: "python3"
args: (context) -> ['-u', '-c', context.getCode()]
"File Based":
command: "python3"
args: (context) -> ['-u', context.filepath]

Save changes, restart Atom and enjoy running your scripts with python 3

EDIT: On Windows I believe the grammars.coffee file is located in
C:/Users/Your_Username/AppData/Local/atom/packages
Again, the AppData folder is hidden so you might have to change your settings to view hidden files and folders.

Running Python from Atom

The script package does exactly what you're looking for: https://atom.io/packages/script

The package's documentation also contains the key mappings, which you can easily customize.

problem with Run python3 code in Atom on ubuntu

EDIT: if you just want to run python3 through atom:
Open the atom-python-run package settings (atom Settings >> packages >> find atom-python-run >> settings)

In F5 command section, change the default to python3 {file}. It should look something like this.

EDIT: Make sure that F5 doesn't interfere with another command from another package. Or else you can use F6 as well.
Sample Image

Restart, atom. You should be good to go!

If you aren't able to run python scripts through atom. Then here's the package you can install.

atom-python-run

In short:

  1. You need python installed on your computer and you need to add it to your PATH

  2. Restart atom

  3. To run your (.py) file, hit F5 or F6

Hope this helps!

How do I get Atom to run Python3 in the terminal platformio-ide-terminal?

You need to activate your virtual environment from the command line. Then run Atom and open your python file. Now hit the F5 or F6 key and your code should run using python 3.x. Where 3.x is however you set up your virtual environment.

To run Python from the terminal in atom, open the terminal and type

python3 script_file

If your virtual environment was set up for python 3.7, then run

python3.7 script_file

To determine what versions you have type which python3 or which phython3,7 or any other version you may have installed.

Atom Script can't find the path for Python 3 on Mac

You need to properly configure the script package to use a profile that points to the correct python3.

  1. Open a Terminal and navigate to the directory containing your scripts.

    $ pwd
    /Users/cerberus/Scripts
  2. Get the path to python3

    • If you installed it via Homebrew, then it should be at:

      $ python3 -V
      Python 3.7.3
      $ which python3
      /usr/local/bin/python3
    • You can also check that Homebrew already updated PATH to add /usr/local/bin, but unless you did something wrong with the Python installation, this part is unnecessary.

      $ echo $PATH
      .../usr/local/bin/:/...
  3. Now, start Atom from the command line as explained in the package docs

    Make sure to launch Atom from the console/terminal. This gives atom
    all your useful environment variables. Additionally, make sure to run
    it with the project path you need.

    $ cd /path/to/scripts
    $ atom .

    OR

    $ atom /path/to/scripts
  4. Go to Packages > Command Palette > Toggle (or use CMD+SHIFT+P)

  5. Select Script: Run Options

Script: Run Options


  1. Input the path to your scripts and the path to the python3 command

create profile

NOTE: On my machine, just setting python3 also works. But if you are having problems with your python path, you can try to specify the full path (/usr/local/bin/python3) as shown.


  1. Save the profile (ex. as "Python3")
  2. Now, when you want to run your Python scripts, use the Script: Run with Profile command and then select the profile you just created.

Script: Run with Profile

select profile


  1. That should work now.

run successful

Run Python in Atom and take user input

Script Runner can run scripts and supports input, unlike Script. It's the simplest full terminal package that I know of. To run a script, press Alt+X

For more advanced usage, you might look at Hydrogen.



Related Topics



Leave a reply



Submit