您的位置:首页 > 其它

[SublimeText] 安装包管理

2016-01-02 10:29 316 查看
由于各种访问原因,因此记录一下给自己使用,原文地址如下:
http://www.bonusbits.com/wiki/HowTo:Setup_Package_Control_for_Sublime_Text

Method 1 (Sublime Text Script)

This will not work if you are behind a proxy. If you're behind a proxy use Method 2.

Open Sublime consoleCTRL+`

Sublime Text 2

import urllib2,os; 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())); open( os.path.join( ipp, pf), 'wb' ).write( urllib2.urlopen( 'http://sublime.wbond.net/' +pf.replace( ' ','%20' )).read()); print( 'Please restart Sublime Text to finish installation')

Sublime Text 3

import urllib.request,os,hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282' + 'd0e7a3098092775ccb37ca9d6b2e4b7d';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 elseopen(os.path.join( ipp, pf), 'wb' ).write(by)

Restart Sublime

Method 2 (Manually)

If you are behind a proxy use this method. After installing then set your proxy settings

Download plugin filehttp://sublime.wbond.net/Package%20Control.sublime-package

Copy Package Control.sublime-package to the Install Packages folder under Sublime Text install folder.
Windows
C:\Users\username\AppData\Roaming\Sublime Text 2\Installed Packages


Mac

sudo cp ~/Downloads/Package\ Control.sublime-package ~/Library/Application\ Support/Sublime\ Text\3/Installed\ Packages/

Restart Sublime

相关文章:
http://blog.jobbole.com/82527/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: