4

我正在尝试在 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/
4

6 回答 6

13

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

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

于 2019-05-03T03:10:36.483 回答
2

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

打开Pycharm-->GoTo Files-->Settings-->Project-->Python Interpreter-->+号-->然后搜索你要安装的。检查适合您的版本并安装它。如果出现错误,请尝试安装它的其他版本。那将解决问题。

于 2020-08-12T19:16:38.023 回答
1

尝试安装 python-dev 版本。

对于python3.7

sudo apt-get install python3.7-dev

对于python3.6

sudo apt-get install python3.6-dev
于 2020-01-27T11:08:28.803 回答
1

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

于 2020-03-04T18:08:15.260 回答
0

对于不同的软件包,我在 MacOS 上遇到了这个问题。我在日志中发现了这个警告:

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

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

于 2020-07-18T20:53:08.580 回答
-8

简单,尝试运行这个:

pip install pep517

然后再次尝试安装

python3 -m pip install chatterbot

于 2019-11-17T22:08:38.900 回答