使用 pip 安装会出现奇怪的问题,所以此处选择用源码安装
这是官方给的安装方法
$ sudo apt-get install python-dev libopenblas-dev
# Clone the repo including submodules (or clone + `git submodule update --init --recursive`)
$ git clone --recursive https://github.com/ibayer/fastFM.git
# Enter the root directory
$ cd fastFM
# Install Python dependencies (Cython>=0.22, numpy, pandas, scipy, scikit-learn)
$ pip install -r ./requirements.txt
# Compile the C extension.
$ make # build with default python version (python)
$ PYTHON=python3 make # build with custom python version (python3)
# Install fastFM
$ pip install .
首先是
git clone --recursive https://github.com/ibayer/fastFM.git
慢得头皮发麻,试了很多次都不行,都是下载到一般就连不上了,最后突发奇想,在服务器上面克隆下来,并传到本地。
然后是在进行 make
的时候,会报错
Detecting CPU failed. Please set TARGET explicitly, e.g. make TARGET=your_cpu_target. Please read README for the detail..
百度没找到解决方法,谷歌了一下,找到了这个 issue
https://github.com/xianyi/OpenBLAS/issues/2227
在原来的 make
命令后面加上 TARGET=NEHALEM
,问题解决。
综上:
- 如果你有云服务器,在云服务器上 git clone 下来(网速稳定)
- 使用
make
时后面加上TARGET=NEHALEM
总结:
- 比较奇怪的问题尽量谷歌,百度搜不到
- 对于底层源码是 C 写的库,尽量使用源码安装
- 下次 git clone 项目,可以在服务器进行克隆