红联Linux门户
Linux帮助

Sublime Text 3 Package Control安装

发布时间:2016-02-02 11:49:08来源:blog.csdn.net/yhl_leo/作者:yhl_leo

安装好Sublime Text 3之后,安装Package Control最简单的方法就是使用命令行安装。

从官网上Package Control Installation(https://packagecontrol.io/installation),中复制下所需的Python代码:


Sublime Text 3:

import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; 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 = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; 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')


打开Sublime Text 3(本人使用的是Ubuntu-Wily(15.10),可以在Terminal中使用命令subl打开),然后要把上面复制的代码,复制到命令窗口中,一定要注意:是按ctrl+` 或者菜单栏View > Show Console打开的命令窗口!如下图:

Sublime Text 3 Package Control安装


本文永久更新地址:http://www.linuxdiyf.com/linux/17830.html