通过 Sublime Text 控制台。可通过快捷方式“ctrl+`”或“View > Show Console”菜单访问控制台。打开后,将适用于您的 Sublime Text 版本的 Python 代码粘贴到控制台中。
Sublime Text3 贴入如下代码:
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 Text2 贴入如下代码:
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')
如果觉得我的回答对您有用,请随意打赏。你的支持将鼓励我继续创作!