如何安装gensim

How to install gensim

我正在使用 Python 2.7。 我一直在尝试使用 easy_install -U gensim 安装 gensim 语料库 但出现以下错误:

Best match: gensim 0.12.3
Downloading https://pypi.python.org/packages/source/g/gensim/gensim-0.12.3.tar.gz#md5=9581467d50ec6da0097939464c422d00
Processing gensim-0.12.3.tar.gz
Writing /tmp/easy_install-gov1DV/gensim-0.12.3/setup.cfg
Running gensim-0.12.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-gov1DV/gensim-0.12.3/egg-dist-tmp-OwbpdK
The required version of setuptools (>=1.3.2) is not available,
and can't be installed while this script is running. Please
install a more recent version first, using
'easy_install -U setuptools'.

(Currently using setuptools 1.1.6 (/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python))
error: Setup script exited with 2

我检查了 setuptools 版本,我发现它是 19.2。

你应该先更新你的setuptools,你有一个旧版本

easy_install https://pypi.python.org/packages/source/s/setuptools/setuptools-19.2.tar.gz

 easy_install --upgrade setuptools

现在尝试重新安装 gensim

第一次尝试 easy_install -U setuptools

然后使用 easy_install -U gensim

在这个地方你可以做两件事 1. 我安装 easy_install

easy_install https://pypi.python.org/packages/source/s/setuptools/setuptools-19.2.tar.gz

2.Use 分布 Python 像 ANACONDA

安装蟒蛇。

conda 安装-c anaconda gensim=0.12.4

某些操作系统不允许卸载某些 python 软件包。在这种情况下,要安装 gensim 包 6 需要卸载,但 MacOS,特别是在 El Capitan 之后(不确定是否所有版本都会发生这种情况,在 Sierra 中也会发生),不允许卸载预安装的包。

要安装 gensim,只需使用 pip 的 --ignore-installed 标志

sudo -H pip install --ignore-installed gensim

确保你已经安装了pip 然后在命令提示符

上执行此命令
pip install --upgrade gensim