簡體   English   中英

使用 pip install leveldb 時出錯

[英]I got error when using pip install leveldb

當我在我的 MAC 中使用 pip install leveldb 時出現以下錯誤,我搜索了整個互聯網但沒有任何回復,我的 python env 是 2.7,讓我不安的是我可以成功使用 Homebrew 安裝,任何人都可以提供幫助我會有所幫助。

Collecting leveldb
  Downloading https://files.pythonhosted.org/packages/ec/c1/ca3b4199bd4073e6430076f1edd8061f2f548e831eeddc3cbc077ebaa0ca/leveldb-0.194.tar.gz (228kB)
    100% |████████████████████████████████| 235kB 377kB/s
Installing collected packages: leveldb
  Running setup.py install for leveldb ... error
    Complete output from command /Users/crowncao/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-0duq9nmj/leveldb/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/tmp/pip-record-q32ow6u8/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'leveldb' extension
    creating build
    creating build/temp.macosx-10.7-x86_64-3.7
    creating build/temp.macosx-10.7-x86_64-3.7/snappy
    creating build/temp.macosx-10.7-x86_64-3.7/leveldb
    creating build/temp.macosx-10.7-x86_64-3.7/leveldb/db
    creating build/temp.macosx-10.7-x86_64-3.7/leveldb/table
    creating build/temp.macosx-10.7-x86_64-3.7/leveldb/util
    creating build/temp.macosx-10.7-x86_64-3.7/leveldb/port
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/crowncao/anaconda3/include -arch x86_64 -I/Users/crowncao/anaconda3/include -arch x86_64 -I/Users/crowncao/anaconda3/include/python3.7m -c ./snappy/snappy.cc -o build/temp.macosx-10.7-x86_64-3.7/./snappy/snappy.o -I./leveldb/include -I./leveldb -I./snappy -I. -fno-builtin-memcmp -O2 -fPIC -DNDEBUG -DSNAPPY -DOS_MACOSX -DLEVELDB_PLATFORM_POSIX -Wno-error=unused-command-line-argument-hard-error-in-future
    warning: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Wunknown-warning-option]
    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]
    In file included from ./snappy/snappy.cc:29:
    ./snappy/snappy.h:43:10: fatal error: 'string' file not found
    #include <string>
             ^~~~~~~~
    2 warnings and 1 error generated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/Users/crowncao/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-0duq9nmj/leveldb/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/tmp/pip-record-q32ow6u8/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-install-0duq9nmj/leveldb/

從錯誤信息中可以看出, stdlibc++標准庫的stdlibc++實現。 人們可以通過使用stdc++實現來“解決”這個問題。 一種方法是在pip install之前修改標志CPPFLAG

export CPPFLAGS="-stdlib=libc++"

有些人已經能夠通過運行來解決此類問題

xcode-select --install

這可能與您的 C++ 安裝有關。 這是一個提示:

警告:包括 stdlibc++ 的路徑

在這里你可以找到類似的討論https://github.com/WebAssembly/wabt/issues/716

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM