用 pip 安装 plyvel

Installing plyvel with pip

我在尝试安装 plyvel 时遇到此错误:

  Running setup.py install for plyvel
    Complete output from command /home/eytan/.virtualenvs/env/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-NVZgbQ/plyvel/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-jHZNqS-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/eytan/.virtualenvs/env/include/site/python2.7/plyvel:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/plyvel
    copying plyvel/__init__.py -> build/lib.linux-x86_64-2.7/plyvel
    copying plyvel/_version.py -> build/lib.linux-x86_64-2.7/plyvel
    running build_ext
    building 'plyvel._plyvel' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/plyvel
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c plyvel/_plyvel.cpp -o build/temp.linux-x86_64-2.7/plyvel/_plyvel.o -Wall -g
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    plyvel/_plyvel.cpp:359:24: fatal error: leveldb/db.h: No such file or directory
     #include "leveldb/db.h"
                            ^
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/home/eytan/.virtualenvs/env/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-NVZgbQ/plyvel/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-jHZNqS-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/eytan/.virtualenvs/env/include/site/python2.7/plyvel" failed with error code 1 in /tmp/pip-build-NVZgbQ/plyvel

谁能解释一下这是怎么回事,我该如何解决?

尝试运行:

sudo apt-get install libleveldb-dev

然后再次尝试 运行 pip 安装。

更多信息:source

您需要安装leveldb开发包

基于 deb 的发行版:

sudo apt-get install libleveldb-dev

基于 RPM 的发行版:

sudo yum install leveldb-devel

请注意 dnf 正在缓慢但稳步地取代 yum。如果您的发行版使用 dnf(例如,Fedora 23 和更新版本),您可以将它放在那里而不是 yum:

sudo dnf install leveldb-devel

对于centos 6.X

yum install epel-release
yum install leveldb-devel