安装Spacy的问题

时间:2018-06-13 12:49:14

标签: macos-sierra spacy

在指令中运行命令:

pip install -U spacy

它无法为收集的包构建轮子:spacy,murmurhash,cymem,preshed,thinc,ujson,regex,cytoolz

这是终端上显示的错误。

  Running setup.py bdist_wheel for spacy ... error
  Complete output from command /usr/local/opt/python/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/9t/0qgpwgy906z_sww71dnkgkr80000gn/T/pip-install-9ygkdvbw/spacy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/9t/0qgpwgy906z_sww71dnkgkr80000gn/T/pip-wheel-swjw2gll --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.13-x86_64-3.6
  creating build/lib.macosx-10.13-x86_64-3.6/spacy
  copying spacy/lemmatizer.py -> build/lib.macosx-10.13-x86_64-3.6/spacy
  copying spacy/compat.py -> build/lib.macosx-10.13-x86_64-3.6/spacy
  ...
  ...
    copying spacy/tests/tokenizer/sun.txt -> build/lib.macosx-10.13-x86_64-3.6/spacy/tests/tokenizer
  running build_ext
  building 'spacy.parts_of_speech' extension
  creating build/temp.macosx-10.13-x86_64-3.6
  creating build/temp.macosx-10.13-x86_64-3.6/spacy
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes /usr/local/opt/openssl/include -I/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/include/python3.6m -I/private/var/folders/9t/0qgpwgy906z_sww71dnkgkr80000gn/T/pip-install-9ygkdvbw/spacy/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c spacy/parts_of_speech.cpp -o build/temp.macosx-10.13-x86_64-3.6/spacy/parts_of_speech.o -O2 -Wno-strict-prototypes -Wno-unused-function
  clang: warning: /usr/local/opt/openssl/include: 'linker' input unused [-Wunused-command-line-argument]
  clang++ -bundle -undefined dynamic_lookup /usr/local/opt/openssl/lib /usr/local/opt/openssl/include build/temp.macosx-10.13-x86_64-3.6/spacy/parts_of_speech.o -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib -o build/lib.macosx-10.13-x86_64-3.6/spacy/parts_of_speech.cpython-36m-darwin.so -Wl,-rpath,@loader_path/../spacy/platform/darwin/lib
  ld: can't map file, errno=22 file '/usr/local/opt/openssl/include' for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  error: command 'clang++' failed with exit status 1

  ----------------------------------------
  Failed building wheel for spacy
  Running setup.py clean for spacy
  Running setup.py bdist_wheel for murmurhash ... error
  Complete output from command /usr/local/opt/python/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/9t/0qgpwgy906z_sww71dnkgkr80000gn/T/pip-install-9ygkdvbw/murmurhash/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/9t/0qgpwgy906z_sww71dnkgkr80000gn/T/pip-wheel-9ytvwkua --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.13-x86_64-3.6
  creating build/lib.macosx-10.13-x86_64-3.6/murmurhash
  copying murmurhash/__init__.py -> build/lib.macosx-10.13-x86_64-3.6/murmurhash
  copying murmurhash/about.py -> build/lib.macosx-10.13-x86_64-3.6/murmurhash
  creating build/lib.macosx-10.13-x86_64-3.6/murmurhash/tests
  copying murmurhash/tests/__init__.py -> build/lib.macosx-10.13-x86_64-3.6/murmurhash/tests
  copying murmurhash/tests/test_import.py -> build/lib.macosx-10.13-x86_64-3.6/murmurhash/tests
  copying murmurhash/mrmr.pyx -> build/lib.macosx-10.13-x86_64-3.6/murmurhash
  copying murmurhash/__init__.pxd -> build/lib.macosx-10.13-x86_64-3.6/murmurhash
  copying murmurhash/mrmr.pxd -> build/lib.macosx-10.13-x86_64-3.6/murmurhash
  creating build/lib.macosx-10.13-x86_64-3.6/murmurhash/include
  creating build/lib.macosx-10.13-x86_64-3.6/murmurhash/include/murmurhash
  copying murmurhash/include/murmurhash/MurmurHash2.h -> build/lib.macosx-10.13-x86_64-3.6/murmurhash/include/murmurhash
  copying murmurhash/include/murmurhash/MurmurHash3.h -> build/lib.macosx-10.13-x86_64-3.6/murmurhash/include/murmurhash
  running build_ext
  building 'murmurhash.mrmr' extension
  creating build/temp.macosx-10.13-x86_64-3.6
  creating build/temp.macosx-10.13-x86_64-3.6/murmurhash
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes /usr/local/opt/openssl/include -I/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/include/python3.6m -I/private/var/folders/9t/0qgpwgy906z_sww71dnkgkr80000gn/T/pip-install-9ygkdvbw/murmurhash/murmurhash/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c murmurhash/mrmr.cpp -o build/temp.macosx-10.13-x86_64-3.6/murmurhash/mrmr.o -O3 -Wno-strict-prototypes -Wno-unused-function
  clang: warning: /usr/local/opt/openssl/include: 'linker' input unused [-Wunused-command-line-argument]
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes /usr/local/opt/openssl/include -I/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/include/python3.6m -I/private/var/folders/9t/0qgpwgy906z_sww71dnkgkr80000gn/T/pip-install-9ygkdvbw/murmurhash/murmurhash/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c murmurhash/MurmurHash2.cpp -o build/temp.macosx-10.13-x86_64-3.6/murmurhash/MurmurHash2.o -O3 -Wno-strict-prototypes -Wno-unused-function
  clang: warning: /usr/local/opt/openssl/include: 'linker' input unused [-Wunused-command-line-argument]
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes /usr/local/opt/openssl/include -I/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/include/python3.6m -I/private/var/folders/9t/0qgpwgy906z_sww71dnkgkr80000gn/T/pip-install-9ygkdvbw/murmurhash/murmurhash/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c murmurhash/MurmurHash3.cpp -o build/temp.macosx-10.13-x86_64-3.6/murmurhash/MurmurHash3.o -O3 -Wno-strict-prototypes -Wno-unused-function
  clang: warning: /usr/local/opt/openssl/include: 'linker' input unused [-Wunused-command-line-argument]
  clang++ -bundle -undefined dynamic_lookup /usr/local/opt/openssl/lib /usr/local/opt/openssl/include build/temp.macosx-10.13-x86_64-3.6/murmurhash/mrmr.o build/temp.macosx-10.13-x86_64-3.6/murmurhash/MurmurHash2.o build/temp.macosx-10.13-x86_64-3.6/murmurhash/MurmurHash3.o -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib -o build/lib.macosx-10.13-x86_64-3.6/murmurhash/mrmr.cpython-36m-darwin.so
  ld: can't map file, errno=22 file '/usr/local/opt/openssl/lib' for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  error: command 'clang++' failed with exit status 1

  ----------------------------------------
  Failed building wheel for murmurhash
  Running setup.py clean for murmurhash

其他库的类似错误。

它可能与查找python头文件有关。我使用此命令检查了位置:

python -c "import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'))"
  

/usr/local/opt/python/Frameworks/Python.framework/Versions/3.6/include/python3.6m

它包含所有头文件。

这个答案(Failed building wheel for spacy)建议单独安装车轮。我如何在Mac OS X上执行此操作?

1 个答案:

答案 0 :(得分:0)

下载Spacy并使用它的最佳方法是手动下载并链接。下面的命令用于下载它并将其链接到您的python库:

下载命令:

pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz

将说明更多信息的链接:https://spacy.io/usage/models#usage-link