环境:Mac
版本:Sublime Text3 简称ST3
一、ST3,安装package Control 报错
按照网上的操作步骤
从菜单 View - Show Console 或者 ctrl + ~ 快捷键,调出 console。将以下 Python 代码粘贴进去并 enter 执行,不出意外安装失败。
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)
报错信息如下:
Traceback (most recent call last):
File "./python3.3/urllib/request.py", line 1248, in do_open
File "./python3.3/http/client.py", line 1065, in request
File "./python3.3/http/client.py", line 1103, in _send_request
File "./python3.3/http/client.py", line 1061, in endheaders
File "./python3.3/http/client.py", line 906, in _send_output
File "./python3.3/http/client.py", line 844, in send
File "./python3.3/http/client.py", line 822, in connect
File "./python3.3/socket.py", line 435, in create_connection
File "./python3.3/socket.py", line 426, in create_connection
TimeoutError: [Errno 60] Operation timed out
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
File "./python3.3/urllib/request.py", line 469, in open
File "./python3.3/urllib/request.py", line 487, in _open
File "./python3.3/urllib/request.py", line 447, in _call_chain
File "./python3.3/urllib/request.py", line 1274, in http_open
File "./python3.3/urllib/request.py", line 1251, in do_open
urllib.error.URLError: <urlopen error [Errno 60] Operation timed out>
原因:
下载超时出错
解决:
手动安装Package Control
按照步骤见官网如下截图
1、点击Preferences > Browse Packages
菜单
2、进入打开的目录的上层目录,然后再进入Installed Packages/目录
3、下载 Package Control.sublime-package 并复制到Installed Packages/目录
PS:我打不开这个文件 ?
So:附上百度网盘下载地址
链接:https://pan.baidu.com/s/1hzG528UBEUFNsq2AWjROhA 密码:hebf
4、重启TX3
二、There are no packages available for installation
通过ctrl+shift+p
打开包管理菜单界面,输入install
选中Install Package
并回车,出现There are no packages available for installation
的提示,导致安装插件出现问题。
这个忘记截图了… ?
原因:
利用sublime进行插件下载时,sublime会调用channel_v3.json
文件,点击Preferences->Package Setting->Package Control ->Setting Default
,可以看到该文件是放置在网络中进行通过 https://packagecontrol.io/channel_v3.json 读取的,而由于GFW的原因,导致无法读取该文件,这也就是导致插件无法下载的原因
解决
1、我们在Preferences->Package Setting->Package Control ->Setting User 中,可以进行用户设置,我们可以将文件 https://packagecontrol.io/channel_v3.json 下载后,进行本地访问。
PS:本人没打开这个文件 ?
So:附上百度网盘下载地址
链接:https://pan.baidu.com/s/1yuAp4lX4Ct8bXrhtIk0odw 密码:9i7c
下载完成后,在Preferences->Package Setting->Package Control ->Setting User
中,添加下面一行代码,路径是你的 channel_v3.json 存放路径
[
"/Users/xyz_persist/Public/sublime/channel_v3.json"
]
现在这个文件看起来是这样的
现在,重启TX3,就可以正常使用install package下载插件啦