简体   繁体   中英

problem with Run python3 code in Atom on ubuntu

script i am using this package on atom.

getting this error

[Command: python3 -u '/home/aditya/Documents/python/py4e book solved problems/not done py4e 5.10ex q1 loop.py']

after making change to. [/home/aditya/.atom/packages/script/lib/grammars] i had changed python to python3

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

  'File Based':
    command: 'python3'
    args: ({filepath}) -> ['-u', filepath]

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. 在此处输入图片说明

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!

Try running "sudo ln -s /usr/bin/python3 /usr/bin/python".

Anyway you can change the default to python3 {file} on settings atom python run from.

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