由于packagecontrol.io容易被墙,访问不稳定,所以需要将Sublime Text安装插件的地址改为中文镜像的地址:
第一步:通过控制台安装插件代码,通过 ctrl+` 或 View > Show Console打开控制台,将Python代码粘贴到控制台,回车。
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.cn/' + 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插件channels,方法如下:
1、打开Package Control配置文件
2、修改或新增channels地址
{ "channels": [ "http://packagecontrol.cn/channel_v3.json" ] }
保存搞定!
说明: 安装完插件时Sublime Text会请求packagecontrol.io提交此次安装的一些基本信息,来统计插件安装的数量,所以,安装过程还是有一些慢。
Manual
If for some reason the console installation instructions do not work for you (such as having a proxy on your network), perform the following steps to manually install Package Control:
- Click the Preferences > Browse Packages… menu
- Browse up a folder and then into the Installed Packages/ folder
- Download Package Control.sublime-package and copy it into the Installed Packages/ directory
- Restart Sublime Text
© 2017