In my terminal, I type $ which python3
, outputting
/opt/local/bin/python3
I would like to configure Atom to run Python3 scripts. In my Atom Config, I have
runner: python: "/opt/local/bin/python3"
However, if I run the following script in some script named filename.py
,
import sys print(sys.version)
I get the following output:
2.7.11 (default, Feb 18 2016, 22:00:44) [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]
How exactly does one set up the PATH for Python3.x scripts to run correctly? Is there a different package I could use?
If you are using Mac OS X, use the directory on the terminal to open the file.
Select the file python3, right click and select "get info". Select the directory from "Where:" and past it in Atom.
As Terry told you:
Then type python3 to the Command space.
It should work, Nahuel :)
Go to the Atom's menu bar -> Packages -> Script -> Configure Scrpit (Or, you can use the shortcut Shift+Ctrl+Alt+O)
Then type python3
to the Command space. Hopefully, it will work.
Best, Terry
You can use the Atom package atom-python-run to launch python code from Atom, the python version can be configured in the package settings. By default atom-python-run uses the syntax python {file}
. If the python command on your system is not yet pointing to python3, just replace the setting and write python3 {file}
.