在conda / MacOS上使用pip安装mmh3软件包

时间:2018-12-15 12:49:10

标签: python pip spacy

所以我试图在MacOS上再次设置并安装需要mmh3的软件包。

当我到达那里时-我收到错误消息,出于所有意图和目的,这些错误也可能对我来说是另一种语言。

到目前为止,

搜索使我相信与我在计算机上拥有的Apple xCode版本有关某事,但是我发现的答案完全没有意义。如果我只想打电话给pip install mmh3,我不知道如何编辑安装文件。

输出如下,我知道它很长-但是我不知道什么是无关紧要的,所以就在那里。与APple重命名c ++或类似的东西有关。任何帮助都感激不尽。请记住,我不知道为什么需要此软件包,只是这样。

Collecting mmh3
  Using cached https://files.pythonhosted.org/packages/fa/7e/3ddcab0a9fcea034212c02eb411433db9330e34d626360b97333368b4052/mmh3-2.5.1.tar.gz
Building wheels for collected packages: mmh3
  Running setup.py bdist_wheel for mmh3 ... error
  Complete output from command /Users/ronan/miniconda3/envs/prodigy/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/29/638ydzz51zxfm1hht53r24w80000gn/T/pip-install-qieyu8iz/mmh3/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/29/638ydzz51zxfm1hht53r24w80000gn/T/pip-wheel-a0npl5pu --python-tag cp37:
  running bdist_wheel
  running build
  running build_ext
  building 'mmh3' extension
  creating build
  creating build/temp.macosx-10.7-x86_64-3.7
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/ronan/miniconda3/envs/prodigy/include -arch x86_64 -I/Users/ronan/miniconda3/envs/prodigy/include -arch x86_64 -I/Users/ronan/miniconda3/envs/prodigy/include/python3.7m -c mmh3module.cpp -o build/temp.macosx-10.7-x86_64-3.7/mmh3module.o
  warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
  1 warning generated.
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/ronan/miniconda3/envs/prodigy/include -arch x86_64 -I/Users/ronan/miniconda3/envs/prodigy/include -arch x86_64 -I/Users/ronan/miniconda3/envs/prodigy/include/python3.7m -c MurmurHash3.cpp -o build/temp.macosx-10.7-x86_64-3.7/MurmurHash3.o
  warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
  1 warning generated.
  creating build/lib.macosx-10.7-x86_64-3.7
  g++ -bundle -undefined dynamic_lookup -L/Users/ronan/miniconda3/envs/prodigy/lib -arch x86_64 -L/Users/ronan/miniconda3/envs/prodigy/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-3.7/mmh3module.o build/temp.macosx-10.7-x86_64-3.7/MurmurHash3.o -o build/lib.macosx-10.7-x86_64-3.7/mmh3.cpython-37m-darwin.so
  clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
  ld: library not found for -lstdc++
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  error: command 'g++' failed with exit status 1

  ----------------------------------------
  Failed building wheel for mmh3
  Running setup.py clean for mmh3
Failed to build mmh3
Installing collected packages: mmh3
  Running setup.py install for mmh3 ... error
    Complete output from command /Users/ronan/miniconda3/envs/prodigy/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/29/638ydzz51zxfm1hht53r24w80000gn/T/pip-install-qieyu8iz/mmh3/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/29/638ydzz51zxfm1hht53r24w80000gn/T/pip-record-z9u9z7f5/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'mmh3' extension
    creating build
    creating build/temp.macosx-10.7-x86_64-3.7
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/ronan/miniconda3/envs/prodigy/include -arch x86_64 -I/Users/ronan/miniconda3/envs/prodigy/include -arch x86_64 -I/Users/ronan/miniconda3/envs/prodigy/include/python3.7m -c mmh3module.cpp -o build/temp.macosx-10.7-x86_64-3.7/mmh3module.o
    warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
    1 warning generated.
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/ronan/miniconda3/envs/prodigy/include -arch x86_64 -I/Users/ronan/miniconda3/envs/prodigy/include -arch x86_64 -I/Users/ronan/miniconda3/envs/prodigy/include/python3.7m -c MurmurHash3.cpp -o build/temp.macosx-10.7-x86_64-3.7/MurmurHash3.o
    warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
    1 warning generated.
    creating build/lib.macosx-10.7-x86_64-3.7
    g++ -bundle -undefined dynamic_lookup -L/Users/ronan/miniconda3/envs/prodigy/lib -arch x86_64 -L/Users/ronan/miniconda3/envs/prodigy/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-3.7/mmh3module.o build/temp.macosx-10.7-x86_64-3.7/MurmurHash3.o -o build/lib.macosx-10.7-x86_64-3.7/mmh3.cpython-37m-darwin.so
    clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
    ld: library not found for -lstdc++
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command 'g++' failed with exit status 1

    ----------------------------------------
Command "/Users/ronan/miniconda3/envs/prodigy/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/29/638ydzz51zxfm1hht53r24w80000gn/T/pip-install-qieyu8iz/mmh3/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/29/638ydzz51zxfm1hht53r24w80000gn/T/pip-record-z9u9z7f5/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/29/638ydzz51zxfm1hht53r24w80000gn/T/pip-install-qieyu8iz/mmh3/

2 个答案:

答案 0 :(得分:1)

我遵循了https://anaconda.org/conda-forge/mmh3链接中的指南,发现它可行。

要使用conda安装此软件包,请执行以下操作之一:

conda install -c conda-forge mmh3

conda install -c conda-forge / label / cf202003 mmh3

答案 1 :(得分:0)

因此,一如既往,答案在您看到后非常简单。

此问题以及所有其他依赖Python引用的C ++库的解决方案都是在实现该软件包时使用的setup.py文件中的if / else块。如果在OSX> = 10.7上运行,则包含并执行的以下代码行将解决pip和Python的此类投诉。

COMPILE_OPTIONS["other"].append("-stdlib=libc++")
LINK_OPTIONS["other"].append("-lc++")
LINK_OPTIONS["other"].append("-nodefaultlibs")

作为参考,here是有关问题来源的一些信息。

该解决方案的信用应该转到@honnibal,现在可以通过this link获得完整的if / else逻辑和块,因此您可以竞猜一下发生了什么。