安装Sublime Text 2/3插件的方法

来源:互联网 发布:官方旗舰店 知乎 编辑:程序博客网 时间:2024/06/01 10:35

最新的直接移步:https://sublime.wbond.net/installation

喜欢官网这句——Warning: Please do not redistribute the install code via another website. It will change with every release. Instead, please link to this page.


1.直接安装

安装Sublime text 2插件很方便,可以直接下载安装包解压缩到Packages目录(菜单->preferences->packages)。

2.使用Package Control组件安装

也可以安装package control组件,然后直接在线安装:

  1. 按Ctrl+`(菜单中View-Show Console)调出console
  2. 粘贴以下代码到底部命令行并回车:
    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')
  3. 重启Sublime Text 2。
  4. 如果在Perferences->package settings中看到package control这一项,则安装成功。

用Package Control安装插件的方法:

  1. 按下Ctrl+Shift+P(菜单Tools-Command Palette)调出命令面板
  2. 输入install 调出 Install Package 选项并回车,然后在列表中选中要安装的插件。不爽的是,有的网络环境可能会不允许访问陌生的网络环境从而设置一道防火墙,而Sublime Text 2貌似无法设置代理,可能就获取不到安装包列表了。


贴下ST3在线安装命令:

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)


原创粉丝点击