afra
  • 206

我想在sublimetext上通过PackageControl安装Emmet插件,但是在安装PackageControl时出错

我安装的是sublimeText3,下面是我进行的步骤,和报错的信息。

我主要是想装Emmet这个插件,方便开发html和css。

我看到github上Emmet安装方法有下面两种:Emmet 的github地址

我尝试第一种安装方式

With Package Control:

Run “Package Control: Install Package” command, find and install Emmet
plugin. Restart ST editor (if required)

这个就是通过Package Control安装,我按照packagecontrol官网上给的代码运行会报错,进度就卡在这个地方。

我操作的步骤是:
step1.打开sublimeText
step2.View > Show Console
step3.复制以下代码到控制台并回车

import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; 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)

step4.控制台给出的错误信息:

DPI scale: 1
startup, version: 3083 windows x64 channel: stable
executable: /E/Sublime Text 3/sublime_text.exe
working dir: /E/Sublime Text 3
packages path: /C/Users/刘雨丹/AppData/Roaming/Sublime Text 3/Packages
state path: /C/Users/刘雨丹/AppData/Roaming/Sublime Text 3/Local
zip path: /E/Sublime Text 3/Packages
zip path: /C/Users/刘雨丹/AppData/Roaming/Sublime Text 3/Installed Packages
ignored_packages: ["Vintage"]
pre session restore time: 0.254283
startup time: 0.305283
first paint time: 0.307283
reloading plugin Default.block
reloading plugin Default.comment
reloading plugin Default.copy_path
reloading plugin Default.delete_word
reloading plugin Default.detect_indentation
reloading plugin Default.duplicate_line
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading plugin Default.indentation
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.new_templates
reloading plugin Default.open_context_url
reloading plugin Default.open_file_settings
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.quick_panel
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.swap_line
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.trim_trailing_white_space
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
plugins loaded
import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; 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 "./urllib/request.py", line 1248, in do_open
  File "./http/client.py", line 1065, in request
  File "./http/client.py", line 1103, in _send_request
  File "./http/client.py", line 1061, in endheaders
  File "./http/client.py", line 906, in _send_output
  File "./http/client.py", line 844, in send
  File "./http/client.py", line 822, in connect
  File "./socket.py", line 435, in create_connection
  File "./socket.py", line 426, in create_connection
TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "./urllib/request.py", line 156, in urlopen
  File "./urllib/request.py", line 469, in open
  File "./urllib/request.py", line 487, in _open
  File "./urllib/request.py", line 447, in _call_chain
  File "./urllib/request.py", line 1268, in http_open
  File "./urllib/request.py", line 1251, in do_open
urllib.error.URLError: <urlopen error [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。>

我尝试第二种安装方法,

Manually:

Clone or download git repo into your packages folder (in ST, find
Browse Packages... menu item to open this folder) Restart ST editor
(if required)

我不太会使用github。
我直接按了“download ZIP”这个按钮,下载了一个“emmet-sublime-master.zip”文件。
clipboard.png
解压后里面的内容是这样的,跟网上的教程也不太一样,接下来不知道要怎么办了,我感觉我的方法有问题,希望大神指教:

clipboard.png

阅读 4.9k
评论 更新于 2015-12-29
    3 个回答
    afra
    • 206

    昨天我继续尝试第一张办法安装,在把package control那段代码复制到控制台里始终连不上。
    后来我看到官网上还有另外一种办法安装package control,具体步骤:


    step1:

    preference->browse packages
    

    step2:

    创建文件夹,命名为“Installed Packages”
    

    clipboard.png

    step3:

    下载Package Control.sublime-package

    package control官网的地址,在里面可以找到并下载到这个包。我实验室的网太慢,经常进不去,多刷几次就能打开了。

    clipboard.png

    好了,现在上面三步都完成了。
    下面的工作:


    step1:

    按下快捷键组合:ctrl+shift+p
    

    step2:

    输入ip,点击第一个install package
    

    clipboard.png

    step3:

    输入想要安装的插件“emmet”,点击。
    

    step4:

    OK.All done!!!
    

    clipboard.png

    clipboard.png


    另外:

    我在等待安装pyv8的时候,出现的下面的警告。以及有时候我在安装package control的时候经常提示我,下面的错误信息。

    安装package control时的错误信息(图是从别处拷贝的):

    package control:There are no package available for installation.
    

    clipboard.png

    安装pyv8时的错误信息:

    Error while loading PyV8 binary:exit code 3 Try to manually install PyV8 form...
    

    clipboard.png

    出现错误的原因是:

    1.网络状况不好。
    2.IPv6的原因

    解决方案是:

    1.网络不好的话,不断的重试重试就成功了。
    2.出现package control的错误提示信息据说也可能是IPv6的原因,我把别人的解决方案也贴上来:
    http://blog.csdn.net/freshlover/article/details/44261229

    至此,我想我的sublime text3/package control/emmet就都安装好了。

    评论 赞赏 2015-12-30

      你首先要有Package Control这个包管理,如何安装看这个installation Package Control

      安装好之后,
      在Sublime Text 3中按下快捷键Ctrl+Shift+P,
      在出现的文本框中输入Install Package(或直接输入“ip”)选中Install Package并回车,
      输入或选择你需要的插件再按Enter(回车)就可以安装插件了

      最后关于git的使用可以参照Git教程 - 廖雪峰的官方网站

      评论 赞赏 2015-12-29
        eric
        • 2.1k

        挂代理重新安装 PackageControl 试试

        评论 赞赏 2015-12-29
          撰写回答

          登录后参与交流、获取后续更新提醒