Set up Python 3 build system with Sublime Text 3
The reason you're getting the error is that you have a Unix-style path to the python
executable, when you're running Windows. Change /usr/bin/python3
to C:/Python32/python.exe
(make sure you use the forward slashes /
and not Windows-style back slashes \
). Once you make this change, you should be all set.
Also, you need to change the single quotes '
to double quotes "
like so:
{
"cmd": ["c:/Python32/python.exe", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
The .sublime-build
file needs to be valid JSON, which requires strings be wrapped in double quotes, not single.
Sublime Text 3 Python3 build not working?
You can create a new build system
for python3 on Linux if the built-in method is not working.
First, open your terminal and write
$ which python3
it will give you the location of python3
/usr/bin/python3
Then in sublime text go to tools -> Build System -> New Build System
and paste below code in that file and change location of the python if it is in a different location:
{
"cmd": ["/usr/bin/python3", "-u", "$file"],
"file_regex": "^[ ]File \"(...?)\", line ([0-9]*)",
"selector": "source.python"
}
Now save it using anyname_you_want.sumblime-build
and open a python file then select tools -> Build System -> anyname_you_want
and run your python file. It should work.
How to run Python3 on Sublime Text 3 on macOS?
IIRC (I haven't used Sublime in a while), path
should be the path to the directory, not the executable. Try this instead:
{
"path": "/usr/local/bin/",
"cmd": ["python3", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
It seems like Python is already in your system PATH though, so the path
key seems unnecessary.
Related Topics
Tab Completion in Python's Raw_Input()
How to Trace the Path in a Breadth-First Search
Assigning String with Boolean Expression
Pip Connection Failure: Cannot Fetch Index Base Url Http://Pypi.Python.Org/Simple/
How to Convert Defaultdict to Dict
If Two Variables Point to the Same Object, Why Doesn't Reassigning One Variable Affect the Other
Differencebetween a Pandas Series and a Single-Column Dataframe
How to Remove Leading and Trailing Zeros in a String? Python
Sorting a 2D Numpy Array by Multiple Axes
How to Replace Back Slash Character with Empty String in Python
Does Flask Support Regular Expressions in Its Url Routing
How to "Zip Sort" Parallel Numpy Arrays
How to Call Python Code from C Code
Comments Not Working in Jinja2