解決sublimeText3無法安裝插件問題 -- There are no packages available for installation
There are no packages available for installation錯誤
今天在安裝sublimeText3插件時遇到錯誤,彈出一個對話框說沒有可供安裝的包,內容為There are no packages available for installation,對話框如下圖:
其實我用的是win7系統,我遇到錯誤時沒有截圖,上面的圖片是從網絡上找到的(應該是從ubuntu中截取的),但提示內容是一樣的。
經過google搜索,在 stackoverflow的問答中找到解決辦法,詳情可以參考這里:http://stackoverflow.com/questions /25105139/sublime-text-2-there-are-no-packages-available-for- installation,解決辦法就是這個問題被采納的答案所描述的。
據說是IPv6的原因,如果我們的Intent服務提供者(ISP)不支持IPv6就會引發上述錯誤,原文如下:
This error is happened with IPv6 problem. If your Internet Service Provider (ISP) does not support for IPv6 you got this error.
解決辦法(windows平台)
上面鏈接中給出的解決辦法原文如下:
Step 1:
Get IPv4 address of sublime.wbond.net
Try this command line on terminal ping sublime.wbond.net
Now you can get IPv4 address of sublime.wbond.net.
Step 2:
Now open hosts file from C:\Windows\system32\drivers\etc\
folder and add this line (replcae {IPv4 address})
{IPv4 address} sublime.wbond.net
.
All is ok. Let's play with Package controller.
從上面的描述可以知道首先需要獲取sublime.wbond.net網站的IPv4地址,然后修改hosts文件就行了。
如果在終端使用ping命令時遇到如下錯誤
可以到這里(在線Ping工具)查尋其IP地址:http://serve.netsh.org/pub/ping.php
然后修改hosts文件就可以了,在hosts文件中添加一行,其中IP是ping命令得到的,如下所示:
- 50.116.34.243 sublime.wbond.net
經過上面的步驟,再 Ctrl+Shift+P 打開 Package Control: Install Package 安裝插件就可以了
Package Control
至於 Package Control 插件的安裝,可以參考這里:https://sublime.wbond.net/installation
第一種方法
打開控制台(ctrl+` 快捷鍵或者 View > Show Console 菜單),然后輸入下面的代碼:
- import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; 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)
第二種方法
手動下載插件 包:https://sublime.wbond.net/Package%20Control.sublime-package,復制 到%SumlimeText_HOME%\Data\Installed Packages路徑,重啟 sublimeText 就行了。