【编程环境准备】在win10上配置sublimetext4运行python3最佳教程
1)下载和安装
安装Python3.8.10
略
安装Sublime Text
略
2)设定解释器路径
配置sublimetext做PythonIDE关键一步
Tools->Build System->New Build System
将里面的代码替换如下:
{
"cmd": ["D:/Python38/python.exe","-u","$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"encoding": "cp936"
}里面的红色路径是Python的解释器文件路径
3)缩进风格的显示
在Preferences->Settings 打开的JSON配置文件里追加,设置总是显示 Tab ,以避免Tab和Space混用导致语法错误:
"draw_white_space": ["all_tabs","selection"],
4)安装辅助插件
一、代码补全提示插件
1)安装代码补全插件
Before installing SublimeCodeIntel
, you must ensure that CodeIntel
is installed on your system. To install CodeIntel
, do the following;Install CodeIntel
by typing the following in a terminal:
pip3 install --upgrade --pre CodeIntel -i https://pypi.douban.com/simple/
项目地址:https://github.com/SublimeCodeIntel/SublimeCodeIntel/
打开Sublime,Preferences—>Package Control ,填写"Package Control: Install Package",选中SublimeCodeInter安装;
安装过程需要等10分钟; 或者手动下载并解压插件包,放置在\Sublime Text\Data\Packages目录下
出现上图中的选项,就说明插件安装成功了。
2)在用户家目录创建.codeintel目录
并在该文件夹里创建文件config.log
{ "JavaScript": { "javascriptExtraPaths": [] }, "Python": { "python": "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python38\\python.exe", "pythonExtraPaths": ["C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python38\\Lib\\site-packages"] }, }
红色路径要改成你自己的Python安装路径,配图如下:
二、文件字符集转换插件
ConvertToUTF8
安装方法同上
三、左侧边栏增强插件
SideBarEnhancements
配置排除的目录和文件拓展名
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
{
"folder_exclude_patterns": [
"__pycache__",
"CVS",
".svn",
".hg",
".git"
],
"file_exclude_patterns": [
".DS_Store",
"*.suo",
"*.sublime-workspace",
"*.so",
"*.sdf",
"*.pyo",
"*.pyc",
"*.psd",
"*.pdb",
"*.obj",
"*.o",
"*.ncb",
"*.lib",
"*.idb",
"*.exe",
"*.dylib",
"*.dll",
"*.db",
"*.class",
"*.a"
]
}
四、input()交互式输入插件
SublimeREPL
安装插件
点击Sublime Text 3菜单栏Preferences->Key Bindings。
在新弹出的窗口中,在Default(Windows/MacOS).sublime-keymap--User中输入如下的代码,保存后退出。
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
{ "keys": ["f5"], "caption": "SublimeREPL:Python", "command": "run_existing_window_command", "args": { "id": "repl_python_run", "file": "config/Python/Main.sublime-menu" } },
以上代码设置F5快捷启动插件。先运行脚本,然后按F5就可以键盘input()输入了,大功告成。
到此为止,在win10系统上的PythonIDE编程环境已经搭好了!