Python 安装 chatterbot 但收到“错误:无法为使用 PEP 517 且无法直接安装的 spacy 构建轮子”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/55962678/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 20:36:27  来源:igfitidea点击:

Installing chatterbot but getting "ERROR: Could not build wheels for spacy which use PEP 517 and cannot be installed directly"

pythonmacoschatterbot

提问by jfar7

I'm trying to install chatterbot on macOS with

我正在尝试在 macOS 上安装 chatterbot

python3 -m pip install chatterbot

and every time I get the same error during the step "Installing build dependencies ... /"

每次我在“安装构建依赖项.../”步骤中遇到相同的错误时

ERROR: Failed building wheel for spacy
Running setup.py clean for spacy
Failed to build spacy
ERROR: Could not build wheels for spacy which use PEP 517 and cannot be installed directly

Can someone please help?

有人可以帮忙吗?

Installing collected packages: spacy, chatterbot
  Running setup.py install for spacy ... error
    ERROR: Complete output from command /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/ry/sht50z853vn58nwg6wbzt4l00000gn/T/pip-install-33629q9f/spacy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/ry/sht50z853vn58nwg6wbzt4l00000gn/T/pip-record-z9jsui8q/install-record.txt --single-version-externally-managed --compile:
    ERROR: running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.7
    creating build/lib.macosx-10.9-x86_64-3.7/spacy
    copying spacy/lemmatizer.py -> build/lib.macosx-10.9-x86_64-3.7/spacy


running build_ext
    building 'spacy._align' extension
    creating build/temp.macosx-10.9-x86_64-3.7
    creating build/temp.macosx-10.9-x86_64-3.7/spacy
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -I/private/var/folders/ry/sht50z853vn58nwg6wbzt4l00000gn/T/pip-install-33629q9f/spacy/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c spacy/_align.cpp -o build/temp.macosx-10.9-x86_64-3.7/spacy/_align.o -O2 -Wno-strict-prototypes -Wno-unused-function -stdlib=libc++
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/ry/sht50z853vn58nwg6wbzt4l00000gn/T/pip-install-33629q9f/spacy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/ry/sht50z853vn58nwg6wbzt4l00000gn/T/pip-record-z9jsui8q/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/ry/sht50z853vn58nwg6wbzt4l00000gn/T/pip-install-33629q9f/spacy/

回答by Nick T

You could try python3 -m pip install --no-binary spacy chatterbot, which should tell pip to not build the wheel

你可以试试python3 -m pip install --no-binary spacy chatterbot,这应该告诉 pip 不要造轮子

Alternately python3 -m pip install --no-use-pep517 chatterbot.

交替python3 -m pip install --no-use-pep517 chatterbot

回答by Yash Choubey

Try installing the python-dev version.

尝试安装 python-dev 版本。

For python3.7

对于python3.7

sudo apt-get install python3.7-dev

For python3.6

对于python3.6

sudo apt-get install python3.6-dev

回答by Shirish Singh

In one of the scenarios where if you are using Anaconda, then you have to install using this command: conda install -c conda-forge spacy, hope this helps !!

在其中一种情况下,如果您使用的是 Anaconda,那么您必须使用以下命令进行安装:conda install -c conda-forge spacy,希望这会有所 帮助!!

回答by Francesco Mantovani

Easy, try to run this:

很简单,尝试运行这个:

pip install pep517

And then try to install again

然后再次尝试安装

python3 -m pip install chatterbot

python3 -m pip install chatterbot