当前位置: 首页 > 工具软件 > pylibmc > 使用案例 >

安装 pylibmc 出错

史弘博
2023-12-01

错误栈:

Collecting pylibmc==1.6.0
  Using cached https://files.pythonhosted.org/packages/f4/09/58b9621fc4e0433037b70f053e51a053406e75ec5f68522dcb887792bc1f/pylibmc-1.6.0.tar.gz
Installing collected packages: pylibmc
  Running setup.py install for pylibmc ... error
    Complete output from command /Users/apple/.pyenv/versions/3.7.1/envs/lutun_env3.7.1/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/y7/1gv6zdq112ncsrbhm57cyl3h0000gn/T/pip-install-xgg4qfb7/pylibmc/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/y7/1gv6zdq112ncsrbhm57cyl3h0000gn/T/pip-record-ms3ybemg/install-record.txt --single-version-externally-managed --compile --install-headers /Users/apple/.pyenv/versions/3.7.1/envs/lutun_env3.7.1/include/site/python3.7/pylibmc:
    /private/var/folders/y7/1gv6zdq112ncsrbhm57cyl3h0000gn/T/pip-install-xgg4qfb7/pylibmc/setup.py:98: DeprecationWarning: 'U' mode is deprecated
      with open("README.rst", "U", encoding="utf-8") as r:
    /private/var/folders/y7/1gv6zdq112ncsrbhm57cyl3h0000gn/T/pip-install-xgg4qfb7/pylibmc/setup.py:100: DeprecationWarning: 'U' mode is deprecated
      with open("src/pylibmc-version.h", "U", encoding="utf-8") as r:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.13-x86_64-3.7
    creating build/lib.macosx-10.13-x86_64-3.7/pylibmc
    copying src/pylibmc/autoconf.py -> build/lib.macosx-10.13-x86_64-3.7/pylibmc
    copying src/pylibmc/pools.py -> build/lib.macosx-10.13-x86_64-3.7/pylibmc
    copying src/pylibmc/client.py -> build/lib.macosx-10.13-x86_64-3.7/pylibmc
    copying src/pylibmc/__init__.py -> build/lib.macosx-10.13-x86_64-3.7/pylibmc
    copying src/pylibmc/test.py -> build/lib.macosx-10.13-x86_64-3.7/pylibmc
    copying src/pylibmc/consts.py -> build/lib.macosx-10.13-x86_64-3.7/pylibmc
    copying src/pylibmc/__main__.py -> build/lib.macosx-10.13-x86_64-3.7/pylibmc
    running build_ext
    building '_pylibmc' extension
    creating build/temp.macosx-10.13-x86_64-3.7
    creating build/temp.macosx-10.13-x86_64-3.7/src
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -DUSE_ZLIB -I/usr/local/include -I/Users/apple/.pyenv/versions/3.7.1/envs/lutun_env3.7.1/include -I/Users/apple/.pyenv/versions/3.7.1/include/python3.7m -c src/_pylibmcmodule.c -o build/temp.macosx-10.13-x86_64-3.7/src/_pylibmcmodule.o -fno-strict-aliasing -std=c99
    In file included from src/_pylibmcmodule.c:34:
    src/_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
    
    ----------------------------------------
Command "/Users/apple/.pyenv/versions/3.7.1/envs/lutun_env3.7.1/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/y7/1gv6zdq112ncsrbhm57cyl3h0000gn/T/pip-install-xgg4qfb7/pylibmc/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/y7/1gv6zdq112ncsrbhm57cyl3h0000gn/T/pip-record-ms3ybemg/install-record.txt --single-version-externally-managed --compile --install-headers /Users/apple/.pyenv/versions/3.7.1/envs/lutun_env3.7.1/include/site/python3.7/pylibmc" failed with error code 1 in /private/var/folders/y7/1gv6zdq112ncsrbhm57cyl3h0000gn/T/pip-install-xgg4qfb7/pylibmc/
 

解决:

  1. mac:

    brew uninstall memcached #to remove wrong package(如果你事先已经安装memcached)
    
    brew install libmemcached #install correct lib
    
    pip install pylibmc
  2.  ubuntu or Centos:

    sudo apt-get install libmemcached-devel
    sudo yum install libmemcached-devel

 

 

 类似资料: