Mac OS X El CapitanでSublim Text 3を使用しています。私がする必要があるのは、サブライムテキスト3内のPythonファイルを評価することです。SublimREPLプラグインでファイルを評価するためのPythonバージョンを変更する
とSublimREPL
のプラグインがインストールされています。
画面の2番目の部分にPythonインタプリタを表示するために2行のレイアウト(View > Layout > Rows: 2
)を設定しました。
次に、Tools > Command Palette... > SublimeREPL: Python
でPythonインタプリタを起動します。
インタプリタが正しく起動し、私はこれを取得:
私は(これ/usr/local/bin/
に設置)を手動でダウンロードしたのPython 3.5で開始する方法を見つけることができません。私はこのファイルを変更しようとしました:/Library/Application Support/Sublime Text 3/Packages/SublimeREPL/Config/Python/Main.sublime-menu
this post命令に続いていますが、これは何も変更されませんでした(Python 2.7.10はまだ起動しました)。ここで
は私Main.sublime-menu
の内容です:
[
{
"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": ["python", "-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": ["python", "-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": "R",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["python", "-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": "I",
"args": {
"type": "subprocess",
"encoding": "utf8",
"autocomplete_server": true,
"cmd": {
"osx": ["python", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"],
"linux": ["python", "-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"
}
}
}
]}
]
}]
}
]
それでもthis postアドバイス以下、私は以下のコードの一部を変更したが、私は、フォルダ/usr/local/bin/
内の任意のexeファイルを見つけることができません。
{"command": "repl_open",
"caption": "Python - PDB current file",
"id": "repl_python_pdb",
"mnemonic": "D",
"args": {
"type": "subprocess",
"encoding": "utf8",
"cmd": ["/usr/local/bin/python3", "-i", "-u", "-m", "pdb", "$file_basename"],
"cwd": "$file_path",
"syntax": "Packages/Python/Python.tmLanguage",
"external_id": "python",
"extend_env": {"PYTHONIOENCODING": "utf-8"}
}
}
Ctrl
+ ,
+ f
(docによる)を押すと、インタプリタはまだPython 2.7.10から始まります。
OSXではなくLinuxでPython3.xのインストールには、 'python3'や' python35'のような名前の実行可能ファイルがあります。 '/ usr/local/bin /'が空であれば '/ usr/bin'にインストールされていて、'/Library/Frameworks/'や' – David
コマンドラインで、python3を実行することができれば、 'whereis python'や' which python'がどこにあるのかを知ることができます。同様に、Python 3インタプリタの 'import site; print(site.USER_SITE) ''はpython3のsite-packagesディレクトリの場所を表示するはずです。 – David