Sublime Text 3安装Package Control

2016-11-09  本文已影响502人  樱落e_e

官网地址:官网链接

INSTALLATION

Simple

The simplest method of installation is through the Sublime Text console. The console is accessed via the ctrl+` shortcut or the View > Show Console menu. Once open, paste the appropriate Python code for your version of Sublime Text into the console.      

import urllib.request,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; 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)

Manual

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 Preferences > Browse Packages… menu                                                             

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  

简单的代码安装

使用Ctrl+`快捷键或者通过View->Show Console菜单打开命令行,粘贴如下代码:

import urllib.request,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; 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)

此时如果顺利的话,此时就可以在Preferences菜单下看到Package Settings和Package Control两个菜单了

麻烦的安装方法

可能由于各种原因,无法使用代码安装,那可以通过以下步骤手动安装Package Control:

1.点击Preferences > Browse Packages菜单

2.进入打开的目录的上层目录,然后再进入Installed Packages/目录

3.下载Package Control.sublime-package并复制到Installed Packages/目录

4.重启Sublime Text

上一篇下一篇

猜你喜欢

热点阅读