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

时间:2019-05-03 02:48:44

标签: python macos chatterbot

我正在尝试在macOS上安装chatterbot

python3 -m pip install chatterbot

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

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

有人可以帮忙吗?

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/

6 个答案:

答案 0 :(得分:2)

通过命令提示符安装kivy时遇到相同的问题。 如果您使用Pycharm,那么有一种避免这些问题的简便方法。

打开Pycharm->转到文件->设置->项目-> Python解释器-> +符号->然后搜索要安装的内容。检查适合您的版本并安装。 如果出现错误,请尝试安装它的其他版本。这样可以解决问题。

答案 1 :(得分:1)

您可以尝试使用python3 -m pip install --no-binary spacy chatterbot,它应该告诉pip不要踩住轮子

或者python3 -m pip install --no-use-pep517 chatterbot

答案 2 :(得分:1)

在其中一种情况下(如果您正在使用Anaconda),则必须使用以下命令进行安装: conda install -c conda-forge spacy ,希望这对您有帮助!

答案 3 :(得分:0)

尝试安装python-dev版本。

对于python3.7

sudo apt-get install python3.7-dev

对于python3.6

sudo apt-get install python3.6-dev

答案 4 :(得分:0)

我在MacOS上遇到了其他包装问题。我在日志中发现此警告:

WARNING: Building wheel for bottleneck failed: [Errno 13] Permission denied: '/Users/avi/Library/Caches/pip/wheels/87'

然后,我让我的用户访问pip / wheels目录,然后安装成功。

答案 5 :(得分:-2)

容易,尝试运行此命令:

pip install pep517

然后尝试重新安装

python3 -m pip install chatterbot