600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > Sublime Text4安装教程

Sublime Text4安装教程

时间:2020-02-22 15:27:59

相关推荐

Sublime Text4安装教程

一、下载Sublime Text4

打开Sublime Text官网Download - Sublime Text

选择对应操作系统版本下载,这里我是windows

二、安装

选择安装位置

默认在C盘,这里我安装到了D盘(点Browse选择安装位置)

打勾的表示添加到右键菜单,某些文本文档或者脚本就可以用Sublime打开,点击next然后install

三、汉化

使用快捷键shift+control+P,打开Package Control查找栏。

输入Install Package Control ,点击之后安装,稍等一会,会弹出提示

点击确定

选择preferences,点击底端的Package Control,输入Install,选择第一个

稍等一会,会弹出一个列表,表示插件列表加载完成

如果有需要的插件可以在里面搜索安装,这里我们输入Chinese,选择第一个

点击之后就汉化完成

如果想转换成英语可以点击帮助,其中最下面有个Language选择,切换语言

四、注册

在帮助中选择输入注册码,注册码如下(全部复制粘贴)

<pre class="md-fences md-end-block ty-contain-cm modeLoaded" spellcheck="false" lang="bash" cid="n198" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">—– BEGIN LICENSE —–Mifeng UserSingle User LicenseEA7E-1184812C0DAA9CD 6BE825B5 FF935692 1750523AEDF59D3F A3BD6C96 F8D33866 3F1CCCEA1C25BE4D 25B1C4CC 5110C20E 5246CC42D232C83B C99CCC42 0E32890C B6CBF018B1D4C178 2F9DDB16 ABAA74E5 95304BEF9D0CCFA9 8AF8F8E2 1E0A955E 4771A57650737C65 325B6C32 817DCB83 A7394DFA27B7E747 736A1198 B3865734 0B434AA5—— END LICENSE ——</pre>

五、配置Sublime,使用Python

单击工具 > 编译系统 > 新建编译系统进入如下界面

将其中大括号中内容替换为:

"cmd":["D:\\Python\\python.exe","-u","$file"],"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)","selector": "source.python","encoding": "utf-8" ,"env": {"PYTHONIOENCODING": "utf8"},"shell":"true"

将 cmd 中的地址替换为你的 Python3 的程序地址,如我 Python3 的程序地址为:D:\\Python\\python.exe

Ctrl+S保存

点击工具中,编译系统,选择python3

编写print("Hello"),按Ctrl+S保存(注意保存时要检查文件名后缀是否为.pyCtrl+b运行,下方控制台显示结果

六、常用开发插件

Anaconda

关于Anaconda的安装和配置可以参考这两篇文章

(2条消息) anaconda安装-超详细版_in546的博客-CSDN博客_anaconda安装

Anaconda详细安装及使用教程(带图文) - 知乎 ()

Anaconda插件可以检查你的代码是否书写错误符合、是否满足PEP8规范,有效提高开发效率。

Anaconda安装完成并配置完成后,打开Package control ,install package,安装插件 Anaconda 和conda(这是两个插件)

按如下选项打开Anaconda插件,进行环境配置

点开后输入代码

{"python_interpreter":"D:\\Edit_tools\\Annaconda\\python.exe",//实际安装路径"suppress_word_completions":true,"suppress_explicit_completions":true,"complete_parameters":true, "auto_formatting":true,"auto_formatting_timeout":3,"enable_signatures_tooltip":true,"merge_signatures_and_doc":true,"swallow_startup_errors":true,"anaconda_linting":false,}

其中第一行的路径需要找到自己的Anaconda的python路径,代码中的路径是我自己的

接着配置conda环境

{// Default Windows settings for sublime-text-conda:// executable is the path to anaconda's python// this python executable is used in order to find conda"executable": "D:\\Edit_tools\\Annaconda\\python.exe",// Directory in which the conda envs are stored// Default location is the user's home directory"environment_directory": "D:\\Edit_tools\\Annaconda\\envs",// System architecture for Python installation// options: 32 or 64 bit"architecture": "64",// configuration is the path to conda's configuration file"configuration": "C:\\Users\\34109\\.condarc",// when true, the scripts will be run through the shell// If your code has a GUI (e.g. a matplotlib plot),// this needs to be true, otherwise Windows suppresses it."run_through_shell": true,// when true, the script execution will be handed over to// the pythonw executable, instead of python"use_pythonw": false,// open repl in second row tab below current file,// closing any existing tabs in that area// assumes files are kept in group 0 (typical)"repl_open_row": false,// when opening a repl using repl_open_row, close any// existing conda repls in the second row first"repl_row_close_existing": false,// save the current file (if dirty) when opening repl"repl_save_dirty": true,// syntax highlighting for Open REPL command// choice between 'python' and 'plaintext'"repl_syntax": "python"}

其中所有的路径都需要改成自己安装Anaconda的路径

注:配置文件.condarc 是第一次运行conda config时,自动创建在用户目录下的隐藏文件

安装完成后即可使用

SublimeREPL

使用Sublime默认的快捷键Ctrl+B运行窗口无法实现Python交互(input输入内容),需要通过SublimeREPL插件实现交互等功能。

按如图所示点击快捷键设置

复制下面这段代码,编写完程序后按F5即可运行

[{"keys": ["f5"],// 绑定按键F5为运行Python程序"caption": "SublimeREPL: Python - RUN current file","command": "run_existing_window_command","args": {"id": "repl_python_run",// 设置为使用SublimeREPL打开"file": "config/Python/Main.sublime-menu"}}]

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。