美文网首页Swift Server
Swift Ubuntu上配置运行环境

Swift Ubuntu上配置运行环境

作者: OneByte | 来源:发表于2018-01-18 16:20 被阅读153次

    1.购买Ubuntu

    vultr上有活动,绑定信用卡有送$10美元,并且vps价格低(最低$2.5一个月)、性价比高:

    服务器区域.png
    价格.png

    2.配置Swift环境

    获取地址.png

    右键->获取链接地址
    wget https://swift.org/builds/swift-4.0.3-release/ubuntu1604/swift-4.0.3-RELEASE/swift-4.0.3-RELEASE-ubuntu16.04.tar.gz

    • 解压

    sudo tar xzf swift-4.0.3-RELEASE-ubuntu16.04.tar.gz

    • 安装Clang

    sudo apt-get install clang

    • 设置环境变量

    echo "export PATH=~/swift-4.0.3-RELEASE-ubuntu16.04/usr/bin:"${PATH}"" >> ~/.profile
    source ~/.profile

    • 验证是否正确

    1.$ swift --version
    输出:
    $Swift version 4.0.3 (swift-4.0.3-RELEASE)
    Target: x86_64-unknown-linux-gnu
    2.$ swift

    3.错误提示修复

    • usr/bin/swift-build: error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory

    sudo apt-get install libcurl

    • usr/bin/lldb: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory

    sudo apt-get install libpython2.7

    相关文章

      网友评论

        本文标题:Swift Ubuntu上配置运行环境

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