sublime text3 可以使用 Package Control 安裝其他插件,來提高開發效率。所以我們先要知道Package Control是怎么安裝的。
1、安裝Package Control
Package Control官網安裝:https://packagecontrol.io/installation
Simple:
The simplest method of installation is through the Sublime Text console. The console is accessed via the ctrl+` shortcut or the
首先通過快捷鍵 ctrl+` (mac電腦esc下面的按鍵) 或者 View > Show Console 打開控制台(注:如果安裝有QQ輸入法等快捷鍵有沖突的情況時候,可以先修改相關軟件功能快捷鍵的設置),輸入以下代碼,enter即可.
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)
2、自動安裝package control 失敗
報錯展示:
File "./python3.3/urllib/request.py", line 1248, in do_open
........
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "./python3.3/urllib/request.py", line 156, in urlopen
.........
解決方式:顯然自動安裝已經不行,按照官網進行手動安裝即可。
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
- 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
3、不能進行package control:install package,以及后續插件安裝
報錯展示:
Package Control: Unable to download https://packagecontrol.io/channel_v3.jsonafter 3 attempts
* 下載Package Control手動安裝(詳見第一個問題)
* 科、學、上、網下載channel_v3.json,記事本打開,找到"schema_version": "3.0.0".把3.0.0改成2.0,保存
* 把channel_v3.json放到一個安全不會被刪除的目錄下。
* subline菜單欄中的prefrences->package setting->Package control->setting-user。在{}中加入
"channels":
[
"channel_v3的存放目錄完整路徑"
],
* 保存后,ctrl+shift+p,正常安裝就成了。
之前安裝失敗原因:channel_v3.json被牆了,無法下載下來。
