用pip安装plyvel

Eth*_*han 2 python linux pip leveldb

我在尝试安装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
Run Code Online (Sandbox Code Playgroud)

有人可以解释发生了什么,我该如何解决?

Mur*_*nik 5

您需要安装leveldb开发包.

基于deb的发行版:

sudo apt-get install libleveldb-dev
Run Code Online (Sandbox Code Playgroud)

基于RPM的发行版:

sudo yum install leveldb-devel
Run Code Online (Sandbox Code Playgroud)

请注意,这dnf是缓慢但肯定的替代yum.如果您的发行版使用dnf(例如,Fedora 23和更新版本),您可以将其放在那里而不是yum:

sudo dnf install leveldb-devel
Run Code Online (Sandbox Code Playgroud)