[sublime] SublimeText 安装 Package Control

SublimeText 安装 PackageControl

  • 手动安装
  • 控制台安装

建议使用 手动安装 方式,控制台安装方式在某一时间点之前可用,截止至撰写本文时亲测不可用。

手动安装

  1. Preferences>Browse Packages… 进入 Packages 目录
  2. 返回上层目录并进入 Installed Packages 目录
  3. 下载 Package Control.sublime-package 并复制到 Installed Packages 目录
  4. 重启 Sublime Text

控制台安装

  1. ctrl+` 或者 View>Show Console 呼出控制台
  2. 根据 sublime 版本复制以下python代码到控制台

Sublime Text 3
import urllib.request,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; 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://packagecontrol.io/' + 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 Text 2
import urllib2,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; 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://packagecontrol.io/' + 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')

posted @ 2017-04-07 00:00  蓬蒿人Zlq  阅读(217)  评论(0编辑  收藏  举报