我正在尝试使用pip在我的虚拟环境中安装pylibmc并获得以下错误
pip install pylibmc
Downloading/unpacking pylibmc
Downloading pylibmc-1.3.0.tar.gz (49kB): 49kB downloaded
Running setup.py egg_info for package pylibmc
warning: no files found matching 'LICENSE'
warning: no files found matching 'runtests.py'
warning: no files found matching '*.py' under directory 'pylibmc'
Installing collected packages: pylibmc
Running setup.py install for pylibmc
building '_pylibmc' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DUSE_ZLIB -I/usr/include/python2.7 -c src/_pylibmcmodule.c -o build/temp.linux-x86_64-2.7/src/_pylibmcmodule.o -fno-strict-aliasing
In file included from src/_pylibmcmodule.c:34:0:
src/_pylibmcmodule.h:42:36: fatal error: libmemcached/memcached.h: No such file or directory
#include <libmemcached/memcached.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Complete output from command /home/satyag/.virtualenvs/inwell/bin/python -c "import setuptools;__file__='/home/satyag/.virtualenvs/inwell/build/pylibmc/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-j2sj7j-record/install-record.txt --single-version-externally-managed --install-headers /home/satyag/.virtualenvs/inwell/include/site/python2.7:
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/pylibmc
copying src/pylibmc/__main__.py -> build/lib.linux-x86_64-2.7/pylibmc
copying src/pylibmc/test.py -> build/lib.linux-x86_64-2.7/pylibmc
copying src/pylibmc/__init__.py -> build/lib.linux-x86_64-2.7/pylibmc
copying src/pylibmc/client.py -> build/lib.linux-x86_64-2.7/pylibmc
copying src/pylibmc/pools.py -> build/lib.linux-x86_64-2.7/pylibmc
copying src/pylibmc/consts.py -> build/lib.linux-x86_64-2.7/pylibmc
running build_ext
building '_pylibmc' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DUSE_ZLIB -I/usr/include/python2.7 -c src/_pylibmcmodule.c -o build/temp.linux-x86_64-2.7/src/_pylibmcmodule.o -fno-strict-aliasing
In file included from src/_pylibmcmodule.c:34:0:
src/_pylibmcmodule.h:42:36: fatal error: libmemcached/memcached.h: No such file or directory
#include <libmemcached/memcached.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /home/user/.virtualenvs/proj/bin/python -c "import setuptools;__file__='/home/user/.virtualenvs/proj/build/pylibmc/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-j2sj7j-record/install-record.txt --single-version-externally-managed --install-headers /home/user/.virtualenvs/proj/include/site/python2.7 failed with error code 1 in /home/user/.virtualenvs/proj/build/pylibmc
Storing complete log in /home/user/.pip/pip.log
那么为什么它会向我显示错误?以及如何避免这种错误。
修改
我也试过这种方式,
在此处 https://pypi.python.org/pypi/pylibmc 下载手动下载zip文件并删除命令python setup.py install
,我收到以下错误
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/pylibmc
copying src/pylibmc/__main__.py -> build/lib.linux-x86_64-2.7/pylibmc
copying src/pylibmc/test.py -> build/lib.linux-x86_64-2.7/pylibmc
copying src/pylibmc/__init__.py -> build/lib.linux-x86_64-2.7/pylibmc
copying src/pylibmc/client.py -> build/lib.linux-x86_64-2.7/pylibmc
copying src/pylibmc/pools.py -> build/lib.linux-x86_64-2.7/pylibmc
copying src/pylibmc/consts.py -> build/lib.linux-x86_64-2.7/pylibmc
running build_ext
building '_pylibmc' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DUSE_ZLIB -I/usr/include/python2.7 -c src/_pylibmcmodule.c -o build/temp.linux-x86_64-2.7/src/_pylibmcmodule.o -fno-strict-aliasing
In file included from src/_pylibmcmodule.c:34:0:
src/_pylibmcmodule.h:42:36: fatal error: libmemcached/memcached.h: No such file or directory
#include <libmemcached/memcached.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
答案 0 :(得分:28)
实际上我们需要安装如下所示的开发包
sudo apt-get install libmemcached-dev