永发信息网

如何更改sublimeREPL默认python版本

答案:3  悬赏:60  手机版
解决时间 2021-02-14 10:11
  • 提问者网友:箛茗
  • 2021-02-13 14:24
如何更改sublimeREPL默认python版本
最佳答案
  • 五星知识达人网友:污到你湿
  • 2021-02-13 14:34
如果用Python3的话,在sublimeREPL的config文件夹下新建一个Python3的文件夹,把原来名字是Python文件里面的内容复
制过去,Default.sublime-commands ,Main.sublime-menu 这2个的里面路径改成Python3 的
。然后就有py2 和py3 2种模式了
全部回答
  • 1楼网友:鱼芗
  • 2021-02-13 17:14
python是一款应用非常广泛的脚本程序语言,谷歌公司的网页就是用python编写。python在生物信息、统计、网页制作、计算等多个领域都体现出了强大的功能。python和其他脚本语言如java、r、perl 一样,都可以直接在命令行里运行脚本程序。工具/原料 python;cmd命令行;windows操作系统 方法/步骤 1、首先下载安装python,建议安装2.7版本以上,3.0版本以下,由于3.0版本以上不向下兼容,体验较差。 2、打开文本编辑器,推荐editplus,notepad等,将文件保存成 .py格式,editplus和notepad支持识别python语法。 脚本第一行一定要写上 #!usr/bin/python 表示该脚本文件是可执行python脚本 如果python目录不在usr/bin目录下,则替换成当前python执行程序的目录。 3、编写完脚本之后注意调试、可以直接用editplus调试。调试方法可自行百度。脚本写完之后,打开cmd命令行,前提是python 已经被加入到环境变量中,如果没有加入到环境变量,请百度 4、在cmd命令行中,输入 “python” + “空格”,即 ”python “;将已经写好的脚本文件拖拽到当前光标位置,然后敲回车运行即可。
  • 2楼网友:狂恋
  • 2021-02-13 15:55
stackoverflow上有人提过。 In your Packages/User folder, create SublimeREPL/config/Python/Main.sublime-menu with the following contents: [     {         "id": "tools",         "children":         [{             "caption": "SublimeREPL",             "mnemonic": "r",             "id": "SublimeREPL",             "children":             [                 {                     "caption": "Python",                     "id": "Python",                     "children":[                         {                             "command": "repl_open",                             "caption": "Python - Anaconda",                             "id": "repl_python",                             "mnemonic": "p",                             "args": {                                 "type": "subprocess",                                 "encoding": "utf8",                                 "cmd": ["/path/to/Anaconda/python", "-i", "-u"],                                 "cwd": "$file_path",                                 "syntax": "Packages/Python/Python.tmLanguage",                                 "external_id": "python",                                 "extend_env": {"PYTHONIOENCODING": "utf-8"}                             }                         },                         {                             "command": "repl_open",                             "caption": "IPython - Anaconda",                             "id": "repl_python_ipython",                             "mnemonic": "p",                             "args": {                                 "type": "subprocess",                                 "encoding": "utf8",                                 "autocomplete_server": true,                                 "cmd": ["/path/to/Anaconda/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"                                 }                             }                         }                     ]                 }             ]         }]     } ]In the "cmd"lines, change /path/to/Anaconda/python with the actual path to your python executable you want to use.  Save the file, and you should now have Tools -> SublimeREPL -> Python -> Python - Anacondaand IPython - Anaconda menu options to start REPLs with the Anaconda interpreter. If you have multiple versions of Python installed (for example, 2.7 and 3.3) you can just duplicate the children contents and alter the caption and cmd paths appropriately. 需要注意的是,上述设置中id 最好进行更改,不然会覆盖原来的选项。 完成后再tool->sublimeREPL-python下就会有两个新的选项: Python - Anaconda IPython - Anaconda
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯