Swift Ubuntu上配置运行环境
2018-01-18 本文已影响153人
OneByte
1.购买Ubuntu
vultr上有活动,绑定信用卡有送$10美元,并且vps价格低(最低$2.5一个月)、性价比高:
价格.png
2.配置Swift环境
- 下载 获取地址
右键->获取链接地址
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