Error when install pylibmc using pip

I solved this issue by checking where memcached is installed

$ which memcached
/usr/local/bin/memcached

and then setting LIBMEMCACHED environment variable before pip install:

$ export LIBMEMCACHED=/usr/local
$ pip install pylibmc

It's in the libmemcached package. To install it using macports:

sudo port install libmemcached

Then, assuming you're using pip:

pip install pylibmc --install-option="--with-libmemcached=/opt/local"

or

LIBMEMCACHED=/opt/local pip install pylibmc

as explained in the pylibmc docs.


libmemcached may also be installed using Homebrew.

brew install libmemcached

After that, pip install pylibmc worked for me without needing to specify any additional arguments.