1. 程式人生 > >sublime text3安裝package control (總結)

sublime text3安裝package control (總結)

quest ole 網上 點擊 ins res make () rep

以前安裝完sublime後,都是在網上找相關博客,進行安裝插件。昨天安裝babel插件的時候,搜索不到這個插件。

所以有重新安裝了下,順便總結下,方便自己以後的使用。

1.自動安裝

我用了的是sublime text3,在自動安裝的時候總是失敗,報錯為:file is not a zip files;網上找了好多,都沒有有效的結果。希望有安裝成功的朋友們指點迷津。

安裝方法:sublime text3

快捷鍵ctrl+` 或者View->Show Console,輸入如下代碼

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

快捷鍵ctrl+` 或者View->Show Console,輸入如下代碼

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.手動安裝

通過 https://sublime.wbond.net/Package%20Control.sublime-package

下載packageControl文件

下載完成後,打開sublime text3,選擇菜單Preferences->Browse Packages, 打開安裝目錄,

此時會進入到一個叫做Packages的目錄下,點擊進入上一層目錄Sublime Text3技術分享圖片,在此目錄下有一個文件夾叫做Installed Packages技術分享圖片,把剛才下載的文件放到這裏就可以了。然後重啟sublime text3,觀察Preferences菜單最下邊是否有Package Settings 和Package Control兩個選項,如果有,則代表安裝成功了。此時使用快捷鍵Ctrl+Shift+P,輸入install,選擇install package,接下來從裏面搜索插件的名字即可。

需要註意的一點是,經常會出現網絡聯不通的情況,不要著急,這個很正常,如果出現,隔一會再弄,一般都會好的。

sublime text3安裝package control (總結)