首页 > 解决方案 > 安装 spacy

问题描述

我正在尝试安装 spacy。我正在使用 python 2,我看到了一个帖子Failed building wheel for spacy,因为我遇到了同样的问题。

我跑了pip install --no-cache-dir spacy,但我仍然得到

error: command 'C:\\Users\\amuly\\mingw\\bin\\gcc.exe' failed with exit status 1

    ----------------------------------------
thinc 6.10.3 has requirement dill<0.3.0,>=0.2.7, but you'll have dill 0.2.5 which is incompatible.
Command "c:\users\amuly\anaconda2\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\amuly\\appdata\\local\\temp\\pip-install-aljpyz\\murmurhash\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\amuly\appdata\local\temp\pip-record-ijwq0r\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\amuly\appdata\local\temp\pip-install-aljpyz\murmurhash\
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

很抱歉,但我是新手,找不到解决方案。

谢谢你。

标签: nlpspacy

解决方案


首先,这个(依赖)是 Python 迄今为止最糟糕的部分,每个人都在为此苦苦挣扎。

我注意到您正在使用 pip,但是错误的命令显示您的 python 解释器是 anaconda。你能conda install spacy代替pip install spacy吗?

如果你不使用 conda 环境,你应该(或 pip 和 virtualenv,但如果你在做科学 python,conda 会更干净一些)。环境是保持不同项目的依赖关系分开的方法。例如,如果你想创建一个包含 spacy 的环境,你可以运行

conda create -n my_env_name spacy

然后你会跑

source activate my_env_name

“进入”环境。

您可以稍后添加包(不必在创建环境时安装它们)。进入环境后,您将进入命令行conda install package_name- 但安装将保留在该环境中。


推荐阅读