1.安装Python下载Python安装文件:https://www.python.org/downloads/本次配置测试版本是2.7.8运行下载的msi安装文件即可完成安装,默认安装路径C:\Python27添加Python安装文件至系统环境变量后运行命令行cmd,输入python命令若有下试提示则说明python安装成功安装Pip
pip是python下的包管理工具
通过连接下载 https://bootstrap.pypa.io/get-pip.py下载完成后,命令行cd至get-pip.py所在目录,执行以下命令python
get-pip.py
命令执行后将自动安装get-pip.py和setuptools 安装成功提示如下图
安装成功后,将python目录下的Script文件夹目录添加至环境变量(如:C:\Python27\Scripts)
3. 安装pylint
Pylint是一个 Python 代码分析工具,它分析 Python 代码中的错误,查找不符合代码风格标准和有潜在问题的代码。
(1) 安装pylint前,首先要安装
下载后将两个压缩包分别解压,并运行cmd
cd至各自解压路径,分别运行
python setup.py install
即可正确安装。
两者安装成功后命令行截图如下:
(2)
安装pylint 下载地址:https://pypi.python.org/pypi/pylint下载解压至目录a,同样cd至目录a执行
python setup.py install
即可·,安装过程中可能会提示报错,但最终会提示成功安装。
安装后在命令行执行pylint,如果出现相关提示信息,则说明pylint安装成功。
4. 下载及安装sublime Text 3(略)
5. 配置sublime Text
(1) 安装 Package control
快捷键ctrl+`调出sublime控制台,sublimeText
3输入以下命令安装Package control
import
urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler())
); by = urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join(
ipp, pf), 'wb' ).write(by)
sublime
Text2 输入以下命令:
import
urllib2,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener(
urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating
download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')
(2) 安装pylinter
sublime中打开preferences 中的package control 弹出列表中选择Install Package 输入pylinter进行安装
安装后,preferences 中的package settings中就应该有pylinter了
打开pylinter中的setting-default 修改如下几项:
{
// Show different icons for errors, warnings, etc.
"use_icons": true,
// Automatically run Pylinter when saving a Python document
"run_on_save": true,
// Don't hide pylint messages when moving the cursor
"message_stay": true
}
(3)安装SublimeCodeIntel
安装方法同pylinter,然后菜单中选择Preferences-->Browser
Packages...-->进入相关的目录SublimeCodeIntel\.codeintel找到config
修改配置文件config
"Python": {
"python":"C:/Python27/python.exe",
"pythonExtraPaths":
[
"C:/Python27",
"C:/Python27/DLLs",
"C:/Python27/Lib",
"C:/Python27/Lib/lib-tk",
"C:/Python27/Lib/site-packages"
]
},黄色标注部分按照python具体安装路径更改。
(4) 安装Python PEP8 Autoformat
这是用来按PEP8自动格式化代码的。可以在包管理器中安装。快捷键
CTRL+SHIFT+R 自动格式化python代码,setting-default如下Manually:Download an archive of Python PEP8 Autoformat
Open a terminal, move to Packages directory (refers to the folder that opens when you use the Preferences > Browse Packages… menu) and create a new directory named 'Python PEP8 Autoformat'
Extract archive contents in new 'Python PEP8 Autoformat' directory.
{
"auto_complete": false,
"caret_style": "solid",
"ensure_newline_at_eof_on_save": true,
"find_selected_text": true,
"font_size": 11.0,
"highlight_modified_tabs": true,
"line_padding_bottom": 0,
"line_padding_top": 0,
"scroll_past_end": false,
"show_minimap": false,
"tab_size": 4,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"wide_caret": true,
"word_wrap": true,
}