gensim安装
gensim git地址:https://github.com/piskvorky/gensim
官方主页:http://radimrehurek.com/gensim/index.html
我在redhat 6的python2.6版本下安装
官方文档中只有一句话pip install -U gensim
可惜并不能直接成功,有些依赖包需要手动安装
大部分依赖包根据提示使用yum install或者pip install就可以,如numpy、nose之类的,如果版本较低,可以执行pip install --upgrade nose更新
其中有问题的是scipy这个包,安装时提示:
numpy.distutils.system_info.NotFoundError: no lapack/blas resources found
解决方法来自这篇文章:http://stackoverflow.com/questions/7496547/does-python-scipy-need-blas
具体步骤如下:
mkdir -p ~/src/ cd ~/src/ wget http://www.netlib.org/blas/blas.tgz tar xzf blas.tgz cd BLAS-* ## NOTE: The selected Fortran compiler must be consistent for BLAS, LAPACK, NumPy, and SciPy. ## For GNU compiler on 32-bit systems: #g77 -O2 -fno-second-underscore -c *.f # with g77 #gfortran -O2 -std=legacy -fno-second-underscore -c *.f # with gfortran ## OR for GNU compiler on 64-bit systems: #g77 -O3 -m64 -fno-second-underscore -fPIC -c *.f # with g77 gfortran -O3 -std=legacy -m64 -fno-second-underscore -fPIC -c *.f # with gfortran ## OR for Intel compiler: #ifort -FI -w90 -w95 -cm -O3 -unroll -c *.f # Continue below irrespective of compiler: ar r libfblas.a *.o ranlib libfblas.a rm -rf *.o export BLAS=~/src/BLAS-*/libfblas.a
mkdir -p ~/src cd ~/src/ wget http://www.netlib.org/lapack/lapack.tgz tar xzf lapack.tgz cd lapack-*/ cp INSTALL/make.inc.gfortran make.inc # On Linux with lapack-3.2.1 or newer make lapacklib make clean export LAPACK=~/src/lapack-*/liblapack.a
其中在make lapacklib这部之前要编辑一下make.int
FORTRAN = gfortran OPTS = -O2 -frecursive -fPIC -m64 DRVOPTS = $(OPTS) NOOPT = -O0 -frecursive -fPIC -m64 LOADER = gfortran之后执行pip install scipy即可成功安装,最后执行pip install -U gensim,大功告成。
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。