1. 在线安装
打开Sublime Text 3, 从菜单栏View -->Show Console或者使用Ctrl+`(esc键下面的按键),调出sublime的控制台,将官网中的python代码粘贴进去并按Enter执行,最终可以安装完成。
待粘贴python代码的网址是:https://packagecontrol.io/installation,根据是sublime text 3或者sublime text
sublime text 3:
import urllib.request,os,hashlib;
h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60';
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 = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60';
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')
由于网络问题在线安装我没成功
2. 离线安装
从git下载Package Control主文件到~/.config/sublime-text-3/Packages/,
cd ~/.config/sublime-text-3/Packages/
git clone https://github.com/wbond/package_control_channel.git Package\ Control
- 点击Preferences > Browse Packages菜单
- 进入打开的目录的上层目录,然后再进入Installed Packages目录
- 在下载Package
Control.sublime-package,并将该文件复制到Installed
Packages目录 - 重启Sublime Text。
- 验证package control安装成功:在菜单栏Preferences --> Package Control调出Package
Controller,输入Package Control:Install Package,观察左下角,会提示安装成功。