Reputation: 435
I am on Ubuntu 17.04 LTS, and the default Sublime Text 3 build system fails to import modules that are only for Python 3. For example:
>>> import urllib.request
ImportError: No module named request
Whereas I can successfully import other modules. What can I do?
Thanks in advance.
Upvotes: 0
Views: 1365
Reputation:
There is in your home directory a file
~/.config/sublime-text-3/Packages/Python/Python.sublime-build
which content points to the python executable which should be used for building/running the script.
The content of this file looks like:
{
"cmd": ["/usr/local/bin/python3", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
You can adapt it to your needs specifying the Python3 executable instead of Python2 one.
If you also want your Sublime REPL to run Python3 instead of Python2 change in the
~/.config/sublime-text-3/Packages/SublimeREPL/config/Python/Main.sublime-menu
file the lines:
"cmd": ["python", "-i", "-u"]
to
"cmd": ["python3", "-i", "-u"]
(see also here for some more about it).
Upvotes: 1