一:准备工作
- 安装ubuntu虚拟机,我的为ubuntu16.04
- 安装vmware tool
- 换国内源(阿里或者清华)sudo apt-get update,sudo apt-get upgrade
- 确定自己需要的python版本,安装相应pip,我的版本为python3.5,sudo apt-get install python3-pip
- 安装g++,要求版本大于5.0,系统默认安装5.4版本,ok
- 安装ccache, apt-get install ccache
- pip安装numpy,ply
- sudo apt-get install ctags
二:手动编译swig
- 要求swig版本最低为3.0.12
- 安装方法:https://blog.csdn.net/zhangkzz/article/details/88555830
三:安装cmake3.2.0
四:编译shogun
- 编译方法:https://blog.csdn.net/Cratial/article/details/84261272
- cmake过程当中可能出现问题,根据提示解决就行,如需安装numpy库 ply库 ctags库等
- make过程当中会下载StanMath,如果出错,手动下载:https://github.com/stan-dev/math/archive/v2.18.1.tar.gz将其放入/shogun/third_party/StanMath/v2.18.1.tar.gz,压缩包的名字需要手动改为v2.18.1.tar.gz
- make过程当中还需要手动下载rxcpp,信息中给与了链接,下载放入/shogun/third_party/rxcpp/4.1.0.tar.gz
- make过程中需要占有一定的内存,请确保虚拟机至少有4G内存
- make install
- https://www.jianshu.com/p/8ea02f142cbc按照此链接后面部分设置python环境变量。
注:
- 通过此方法下载的shogun版本为开发版,还未正式发布,因此官网的cookbook教程是无法使用的。可以在github的shogun项目中搜索函数名查看例子。
2. 如果安装完毕后,运行sg.train()遇到glpk问题,参考https://blog.csdn.net/Cratial/article/details/84261272