1. 程式人生 > >解決sublimeText3無法安裝外掛問題 -- There are no packages available for installation

解決sublimeText3無法安裝外掛問題 -- There are no packages available for installation



There are no packages available for installation錯誤

今天在安裝Sublime Text 3外掛時遇到錯誤,彈出一個對話方塊說沒有可供安裝的包,提示原文為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命令時遇到如下錯誤

然後修改hosts檔案就可以了,在hosts檔案中新增一行,其中IP是ping命令得到的,如下所示:

50.116.34.243		sublime.wbond.net

經過上面的步驟,再 Ctrl+Shift+P 開啟 Package Control: Install Package 安裝外掛就可以了

Package Control

第一種方法

開啟控制檯(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) 

第二種方法