【问题标题】:Installing spacy安装 spacy
【发布时间】:2019-01-30 11:29:37
【问题描述】:

我正在尝试安装 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.

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

谢谢。

【问题讨论】:

  • 嗨,艾米,我能够使用相同的命令安装此软件包。您可以尝试检查 pip 是否设置正确并且可以安装任何其他软件包吗?
  • 嗨,是的,我之前一直在安装软件包。但我不确定是否需要升级它。我还没有升级它。你觉得是这个原因吗?
  • 似乎和 windows gcc 错误我做了一个快速搜索,发现下面的链接可以提供帮助:github.com/develersrl/gccwinbinaries。此外,我建议重新安装 python dermal 以获得简单的解决方案。
  • @Helly 谢谢,但我读到 Windows GCC 很难安装和管理。还有其他解决方案吗?我只是想进行依赖解析工作。如果还有其他解决方法,请告诉我。

标签: nlp spacy


【解决方案1】:

首先,这个(依赖)是 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 - 但安装将保留在该环境中。

【讨论】: