python配置

sublime text 3配置过程

参考了:http://www.cnblogs.com/waising/articles/3466120.html

Package Control 安装方法

  1.通过快捷键 ctrl+` 或者 View > Show Console 打开控制台,然后粘贴相应的 Python 安装代码;

  2.Sublime Text 3 安装代码并回车:

import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf),'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())

  3.重启Sublime Text 3;

  4.如果在Perferences->package settings中看到package control这一项,则安装成功。

用Package Control安装插件的方法:

  1. 按下Ctrl+Shift+P调出命令面板
  2. 输入install 调出 Install Package 选项并回车,然后在列表中选中要安装的插件。如图:

 

Pylinter.sublime-settings 配置了pylinter 插件。我使用下面的配置让 Pyhton 在保存时自动规范,并对违反规范显示图标。

这里是和上一步一样,先安装Pylinter插件,然后出现了Pylinter could not automatically determined the path问题

问题参见http://blog.csdn.net/jiangxuchen/article/details/42212387和http://blog.csdn.net/kevinchangblog/article/details/40825717

{
// Configure pylint's behavior
"pylint_rc": "/Users/daniel/dev/pylintrc",

// 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
}

 

SublimeCodeIntel 插件

  智能提示插件,这个插件的智能提示功能非常强大,可以自定义提示的内容库,我的Python智能提示设置

复制代码
 1     "Python": {
 2         "python":"D:/Python27/python.exe",
 3         "pythonExtraPaths":
 4             [
 5                 "D:/Python27",
 6                  "D:/Python27/DLLs",
 7                  "D:/Python27/Lib",
 8                  "D:/Python27/Lib/lib-tk",
 9                  "D:/Python27/Lib/site-packages"
10             ]
11         }
复制代码

 

Python PEP8 Autoformat 插件

 

这是用来按PEP8自动格式化代码的。可以在包管理器中安装。快捷键 CTRL+SHIFT+R 自动格式化python代码

 

常用配置

复制代码
 1 {
 2     "auto_complete": false,
 3     "caret_style": "solid",
 4     "ensure_newline_at_eof_on_save": true,
 5     "find_selected_text": true,
 6     "font_size": 11.0,
 7     "highlight_modified_tabs": true,
 8     "line_padding_bottom": 0,
 9     "line_padding_top": 0,
10     "scroll_past_end": false,
11     "show_minimap": false,
12     "tab_size": 4,
13     "translate_tabs_to_spaces": true,
14     "trim_trailing_white_space_on_save": true,
15     "wide_caret": true,
16     "word_wrap": true,
17 }
复制代码
F12 或 CTRL+B 运行 py文件
如果是F12最好在py文件后加raw_input()否则CMD会一闪而过;

posted on 2015-01-18 23:06  天元突破  阅读(3819)  评论(0编辑  收藏  举报

导航