美文网首页Sublime Text我用 LinuxLinux学习之路
在ubuntu16上安装sublime3出现的问题并解决

在ubuntu16上安装sublime3出现的问题并解决

作者: greedyhao | 来源:发表于2017-07-10 18:16 被阅读1674次

    欢迎关注我的博客Zhuhao's Blog获取最新文章

    首先是安装

    添加sublime text 3的仓库:
    sudo add-apt-repository ppa:webupd8team/sublime-text-3
    根据提示按ENTER 继续,建立信任数据库

    更新软件库
    sudo apt update

    安装Sublime Text 3
    sudo apt install sublime-text-installer
    等待软件安装成功……

    安装Packeage Control(这步开始出现问题

    第一种解决方法(在我这不成功)

    在bash中输入subl后,按ctrl + `,调出命令输入窗口,然后输入以下命令。

    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)
    

    但是我这里尝试这种方法不成功,调试信息如下:

    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
    ConnectionRefusedError: [Errno 111] Connection refused
    
    File "/home/dlyman/.config/sublime-text-3/Packages/tern_for_sublime/tern.py", line 264, in f
    req = opener.open("http://" + localhost + ":" + str(port) + "/", json.dumps(doc).encode("utf-8"), 1)
    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 111] Connection refused>
    

    手动进行安装

    需要从git下载Package Control主文件到~/.config/sublime-text-3/Packages/

    cd ~/.config/sublime-text-3/Packages/
    
    git clone https://github.com/wbond/package_control_channel.git Package\ Control
    

    然后进行下列步骤:

    1. 点击Preferences > Browse Packages菜单
    2. 进入打开的目录的上层目录,然后再进入Installed Packages目录
    3. https://sublime.wbond.net/Package%20Control.sublime-package 下载
      Package Control.sublime-package,并将该文件复制到Installed Packages目录
    4. 重启Sublime Text

    解决无法输入中文问题

    推荐的解决方法

    • Update and then upgrade your system to the newest
    sudo apt-get update && sudo apt-get upgrade
    
    • 把这个repo克隆到你的电脑 :
    git clone https://github.com/lyfeyaj/sublime-text-imfix.git
    
    • sublime-text-imfix 目录:
    cd sublime-text-imfix
    
    • 运行下面这条命令 :
    ./sublime-imfix
    
    • Done! 重启sublime即可完成

    解决Sublime包管理Package Control 报错 There Are No Packages Available For Installation

    解决1:

    网上说是因为IPV6的问题,导致无法访问sublime的官网,于是在host中添加如下对应ip

    #sublime
    #50.116.34.243       sublime.wbond.net
    

    如解决1没有解决这个问题可以去 https://www.cnblogs.com/ae6623/p/5338049.html 查找其他解决方法

    参考源

    相关文章

      网友评论

        本文标题:在ubuntu16上安装sublime3出现的问题并解决

        本文链接:https://www.haomeiwen.com/subject/urjuhxtx.html