无法通过pip安装pylibmc

时间:2021-11-03 20:24:28

I'm trying to install pylibmc on mac.
mac env is osx el capitan 10.11.2.

我正在尝试在mac上安装pylibmc。 mac env是osx el capitan 10.11.2。

I tried pip install pylibmc. but I received following error.

我试过pip install pylibmc。但是我收到了以下错误。

I already installed list below.

我已在下面安装了列表。

  • brew install libmemcached
  • brew安装libmemcached
  • Command Line Tools
  • 命令行工具
  • export CFLAGS=-Qunused-arguments @shell
  • export CFLAGS = -Qunused-arguments @shell
  • export CPPFLAGS=-Qunused-arguments @shell
  • export CPPFLAGS = -Qunused-arguments @shell

How can I install pylibmc??

我怎样才能安装pylibmc?

Installing collected packages: pylibmc
Running setup.py install for pylibmc
Complete output from command /Users/username/.virtualenvs/django-proj/bin/python2.7 -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-goDKgm/pylibmc/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-wxC5F1-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/username/.virtualenvs/django-proj/bin/../include/site/python2.7/pylibmc:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.11-x86_64-2.7
creating build/lib.macosx-10.11-x86_64-2.7/pylibmc
copying pylibmc/__init__.py -> build/lib.macosx-10.11-x86_64-2.7/pylibmc
copying pylibmc/__main__.py -> build/lib.macosx-10.11-x86_64-2.7/pylibmc
copying pylibmc/client.py -> build/lib.macosx-10.11-x86_64-2.7/pylibmc
copying pylibmc/consts.py -> build/lib.macosx-10.11-x86_64-2.7/pylibmc
copying pylibmc/pools.py -> build/lib.macosx-10.11-x86_64-2.7/pylibmc
copying pylibmc/test.py -> build/lib.macosx-10.11-x86_64-2.7/pylibmc
running build_ext
building '_pylibmc' extension
creating build/temp.macosx-10.11-x86_64-2.7
clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DUSE_ZLIB -I/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _pylibmcmodule.c -o build/temp.macosx-10.11-x86_64-2.7/_pylibmcmodule.o -fno-strict-aliasing
In file included from _pylibmcmodule.c:34:
./_pylibmcmodule.h:42:10: fatal error: 'libmemcached/memcached.h' file not found
#include <libmemcached/memcached.h>
         ^
1 error generated.
error: command 'clang' failed with exit status 1

3 个解决方案

#1


11  

first you need to install

首先你需要安装

brew install libmemcached

than install python package by this command

比这个命令安装python包

pip install pylibmc --install-option="--with-libmemcached=/usr/local/Cellar/libmemcached/1.0.18/"

#2


4  

Install dev package:

安装dev包:

sudo apt-get install libmemcached-dev
sudo apt-get install zlib1g-dev

then install with pip the python package :

然后使用pip python包安装:

pip install pylibmc

Check documentation for requirements

检查文档中的要求

#3


0  

three steps including automatically start memcached server when restarting computers

三个步骤,包括重新启动计算机时自动启动memcached服务器

  1. brew install libmemcached
  2. brew安装libmemcached
  3. pip install pylibmc
  4. pip install pylibmc
  5. ln -s /usr/local/Cellar/memcached/1.4.24/homebrew.mxcl.memcached.plist ~/Library/LaunchAgents/ (note: you need to modify the version no to your own one, here is 1.4.24)
  6. ln -s /usr/local/Cellar/memcached/1.4.24/homebrew.mxcl.memcached.plist~/ Library / LaunchAgents /(注意:你需要修改版本号为你自己的版本,这里是1.4.24)
  7. launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist (note: if you do not want auto-start memacached server later, you can use unload command)
  8. launchctl load -w~ / Library / LaunchAgents / homebrew.mxcl.memcached.plist(注意:如果以后不想自动启动memacached服务器,可以使用unload命令)

#1


11  

first you need to install

首先你需要安装

brew install libmemcached

than install python package by this command

比这个命令安装python包

pip install pylibmc --install-option="--with-libmemcached=/usr/local/Cellar/libmemcached/1.0.18/"

#2


4  

Install dev package:

安装dev包:

sudo apt-get install libmemcached-dev
sudo apt-get install zlib1g-dev

then install with pip the python package :

然后使用pip python包安装:

pip install pylibmc

Check documentation for requirements

检查文档中的要求

#3


0  

three steps including automatically start memcached server when restarting computers

三个步骤,包括重新启动计算机时自动启动memcached服务器

  1. brew install libmemcached
  2. brew安装libmemcached
  3. pip install pylibmc
  4. pip install pylibmc
  5. ln -s /usr/local/Cellar/memcached/1.4.24/homebrew.mxcl.memcached.plist ~/Library/LaunchAgents/ (note: you need to modify the version no to your own one, here is 1.4.24)
  6. ln -s /usr/local/Cellar/memcached/1.4.24/homebrew.mxcl.memcached.plist~/ Library / LaunchAgents /(注意:你需要修改版本号为你自己的版本,这里是1.4.24)
  7. launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist (note: if you do not want auto-start memacached server later, you can use unload command)
  8. launchctl load -w~ / Library / LaunchAgents / homebrew.mxcl.memcached.plist(注意:如果以后不想自动启动memacached服务器,可以使用unload命令)