python - 尝试安装 pylibmc 时出现构建错误

标签 python pip libmemcache

刚买了一台新笔记本电脑,从头开始设置我的开发环境,我遇到了这个奇怪的错误,这似乎不是缺少依赖项的结果(尽管我可能是错的)。我正在使用 Python 2.7.3 在 vi​​rtualenv 中工作。 Libevent、libmemcached 和 memcached 之前都是用 Homebrew 安装的。

(grlli)Tylers-MacBook-Pro:grlli tyler$ pip install pylibmc
Downloading/unpacking pylibmc
  Running setup.py egg_info for package pylibmc

Installing collected packages: pylibmc
  Running setup.py install for pylibmc
    building '_pylibmc' extension
    cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -I/usr/local/include -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -DUSE_ZLIB -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _pylibmcmodule.c -o build/temp.macosx-10.8-intel-2.7/_pylibmcmodule.o -fno-strict-aliasing
    _pylibmcmodule.c:1895:33: error: member reference base type 'const void' is not a structure or union
                               svr->hostname, svr->port);
                               ~~~~~^~~~~~~~~~~~~~~~~~~~
    /usr/include/secure/_stdio.h:56:62: note: expanded from macro 'snprintf'
      __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
                                                                 ^
    1 error generated.
    error: command 'cc' failed with exit status 1
    Complete output from command /Users/tyler/projects/envs/grlli/bin/python -c "import setuptools;__file__='/Users/tyler/projects/envs/grlli/build/pylibmc/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/1_/jkd0_x495gs0g8v7z2pgz3bc0000gn/T/pip-E_pLFk-record/install-record.txt --single-version-externally-managed --install-headers /Users/tyler/projects/envs/grlli/bin/../include/site/python2.7:
    running install

running build

running build_py

running build_ext

building '_pylibmc' extension

cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -I/usr/local/include -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -DUSE_ZLIB -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _pylibmcmodule.c -o build/temp.macosx-10.8-intel-2.7/_pylibmcmodule.o -fno-strict-aliasing

_pylibmcmodule.c:1895:33: error: member reference base type 'const void' is not a structure or union

                           svr->hostname, svr->port);

                           ~~~~~^~~~~~~~~~~~~~~~~~~~

/usr/include/secure/_stdio.h:56:62: note: expanded from macro 'snprintf'

  __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)

                                                             ^



1 error generated.

error: command 'cc' failed with exit status 1

----------------------------------------
Command /Users/tyler/projects/envs/grlli/bin/python -c "import setuptools;__file__='/Users/tyler/projects/envs/grlli/build/pylibmc/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/1_/jkd0_x495gs0g8v7z2pgz3bc0000gn/T/pip-E_pLFk-record/install-record.txt --single-version-externally-managed --install-headers /Users/tyler/projects/envs/grlli/bin/../include/site/python2.7 failed with error code 1 in /Users/tyler/projects/envs/grlli/build/pylibmc
Storing complete log in /Users/tyler/.pip/pip.log

非常感谢任何帮助!

最佳答案

我遇到了同样的问题。为我修复它的一件事是将 setuptools 更新到最新版本。

pip install setuptools --upgrade

关于python - 尝试安装 pylibmc 时出现构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13753721/

相关文章:

python - 如何解决这个错误: module 'gensim' has no attribute 'models'

c - libmemcached 问题

Python str View

python - pip 会卸载模块吗?

python - Jupyter Notebook 导入错误,%matplotlib qt

python - 在 Docker 中安装和使用 pip 和 virtualenv

gcc - 如何使用 pip 安装特定版本的包

python - 模块未找到错误 : No module named 'pip.download' when trying to install Python package for Django

python - 安装 libmemcached 时 gcc 失败,退出状态为 1