How to configure Atom to run Python3 scripts? How to configure Atom to run Python3 scripts? python python

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.


i am using "script" package (3.18.1 by rgbkrk) to run code inside atom and this is how i fixed it

  1. open package settings -> view code
  2. open lib -> grammars -> python.coffee
  3. change from python to python3 in those two places 'Selection Based' and 'File Based'


Install atom-runner in your Atom going into your settings of Atom and then inside Package and search for atom-runner and install it.enter image description here

Now click on settings tab for atom-runner as shown above on picture.Then click on View Code as shown in below picture.enter image description here

Then go to lib folder and open atom-runner.coffee and replace the following section of code:

defaultScopeMap:coffee: 'coffee'js: 'node'ruby: 'ruby'python: 'python3'go: 'go run'shell: 'bash'powershell: 'powershell -noninteractive -noprofile -c -'

Make sure that for python keyword value is python3, by default it is python. Refer to the pic below:enter image description here

Other way is to find the location of python3 using command

which python3

for me output is :

/usr/local/bin/python3

and add as a shebang in your every python file. For example:-

#!/usr/local/bin/python3import sysprint("Version ",sys.version)

Only catch is that you have to write this in each file.