sublime repl and python3, not configured. work in linux

0

use linux mint 18 sarah.

my problem is that I do not know how to say sublime text when installing the package sublimeREPL that is installed in python 3 and not in python 2 because the latter is installed by default in linux but I want to use version 3 to program.

I have read infinite posts and I have not found a solution .. I made a new build where I can run my codes with python 3, I tell him to print the version he is working with and effectively espython 3.5 but when I execute the same code from sublime REPL he prints me that he works with python 2.7

How can I solve this? I await your prompt response and excuse my ignorance.

enter the description of the image here

    
asked by Julio Garcia 28.05.2018 в 16:51
source

1 answer

1

I understand that you have already created a Build System that runs Python 3 but you need to configure SublimeREPL to do the same. I use mac but I imagine that the process can be the same.

What you have to do is look for the file Main.sublime-menu in "Sublime Text 3 -> Packages -> SublimeREPL - > config -> Python" and change the code it contains to the following:

[
 {
    "id": "tools",
    "children":
    [{
        "caption": "SublimeREPL",
        "mnemonic": "r",
        "id": "SublimeREPL",
        "children":
        [
            {"caption": "Python",
            "id": "Python",

             "children":[
                {"command": "repl_open",
                 "caption": "Python",
                 "id": "repl_python",
                 "mnemonic": "p",
                 "args": {
                    "type": "subprocess",
                    "encoding": "utf8",
                    "cmd": ["python3", "-i", "-u"],
                    "cwd": "$file_path",
                    "syntax": "Packages/Python/Python.tmLanguage",
                    "external_id": "python",
                    "extend_env": {"PYTHONIOENCODING": "utf-8"}
                    }
                },
                {"command": "python_virtualenv_repl",
                 "id": "python_virtualenv_repl",
                 "caption": "Python - virtualenv"},
                {"command": "repl_open",
                 "caption": "Python - PDB current file",
                 "id": "repl_python_pdb",
                 "mnemonic": "d",
                 "args": {
                    "type": "subprocess",
                    "encoding": "utf8",
                    "cmd": ["python3", "-i", "-u", "-m", "pdb", "$file_basename"],
                    "cwd": "$file_path",
                    "syntax": "Packages/Python/Python.tmLanguage",
                    "external_id": "python",
                    "extend_env": {"PYTHONIOENCODING": "utf-8"}
                    }
                },
                {"command": "repl_open",
                 "caption": "Python - RUN current file",
                 "id": "repl_python_run",
                 "mnemonic": "d",
                 "args": {
                    "type": "subprocess",
                    "encoding": "utf8",
                    "cmd": ["python3", "-u", "$file_basename"],
                    "cwd": "$file_path",
                    "syntax": "Packages/Python/Python.tmLanguage",
                    "external_id": "python",
                    "extend_env": {"PYTHONIOENCODING": "utf-8"}
                    }
                },
                {"command": "repl_open",
                 "caption": "Python - IPython",
                 "id": "repl_python_ipython",
                 "mnemonic": "p",
                 "args": {
                    "type": "subprocess",
                    "encoding": "utf8",
                    "autocomplete_server": true,
                    "cmd": {
                        "osx": ["python", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"],
                        "linux": ["python3", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"],
                        "windows": ["python", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"]
                    },
                    "cwd": "$file_path",
                    "syntax": "Packages/Python/Python.tmLanguage",
                    "external_id": "python",
                    "extend_env": {
                        "PYTHONIOENCODING": "utf-8",
                        "SUBLIMEREPL_EDITOR": "$editor"
                    }
                }
                }
            ]}
        ]
    }]
}]

If you still have problems maybe this video can help you:

Tutorial configuration SublimeREPL to run Python 3

I hope that my answer has been useful, luck Greetings

    
answered by 06.07.2018 в 04:34