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.
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:
You need python installed on your computer and you need to add it to your
PATH
Restart atom
To run your (.py) file, hit
F5
orF6
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
.
Open a Terminal and navigate to the directory containing your scripts.
$ pwd
/Users/cerberus/ScriptsGet 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/python3You 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/:/...
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
Go to Packages > Command Palette > Toggle (or use CMD+SHIFT+P)
- Select Script: Run Options
- Input the path to your scripts and the path to the
python3
command
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.
- Save the profile (ex. as "Python3")
- Now, when you want to run your Python scripts, use the Script: Run with Profile command and then select the profile you just created.
- That should work now.
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
Pandas Sum by Groupby, But Exclude Certain Columns
Pandas Groupby Without Turning Grouped by Column into Index
How Do Python Functions Handle the Types of Parameters That You Pass In
How to Represent an Infinite Number in Python
What Is the Most Compatible Way to Install Python Modules on a MAC
Flask-Sqlalchemy Import/Context Issue
Importerror: No Module Named Win32Com.Client
Unbuffered Stdout in Python (As in Python -U) from Within the Program
Except-Clause Deletes Local Variable
Memory-Efficient Built-In SQLalchemy Iterator/Generator
How to Import Data from Mongodb to Pandas
How to Look Ahead One Element (Peek) in a Python Generator
Interactive Pixel Information of an Image in Python
Return and Yield in the Same Function
Upgrade Python in a Virtualenv
How to Remove the First Item from a List