gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 23:04:22 25 4
gpt4 key购买 nike

在尝试遵循 http://code.google.com/p/python-libmemcached/ 处的 python-libmemcached 说明时我在第 3 步遇到了麻烦(“python setup.py install”)

    (gigmash_venv)m:python-libmemcached matthewparrilla$ python setup.py build
running build
running build_py
creating build
creating build/lib.macosx-10.3-fat-2.7
copying cmemcached.py -> build/lib.macosx-10.3-fat-2.7
running build_ext
building 'cmemcached_imp' extension
creating build/temp.macosx-10.3-fat-2.7
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c cmemcached_imp.c -o build/temp.macosx-10.3-fat-2.7/cmemcached_imp.o
powerpc-apple-darwin9-gcc-4.0.1: cmemcached_imp.c: No such file or directory
powerpc-apple-darwin9-gcc-4.0.1: no input files
i686-apple-darwin9-gcc-4.0.1: cmemcached_imp.c: No such file or directory
i686-apple-darwin9-gcc-4.0.1: no input files
lipo: can't figure out the architecture type of: /var/folders/0o/0oHT3RmJF80rpIJtdbegzE+++TI/-Tmp-//cc9xQqQ6.out
error: command 'gcc-4.0' failed with exit status 1

我几乎不知道这意味着什么或该做什么。我的 comp 上确实有多个版本的 gcc(4.0 和 4.2),并且通过谷歌搜索收集了足够多的信息,这可能很重要。否则完全迷路。

提前致谢。

[编辑:按照@phihag 的说明进行操作]

我现在收到一个完全不同但仍然令人困惑的错误:

    (gigmash_venv)m:python-libmemcached matthewparrilla$ python setup.py build
running build
running build_py
running build_ext
building 'cmemcached_imp' extension
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c cmemcached_imp.c -o build/temp.macosx-10.3-fat-2.7/cmemcached_imp.o
cmemcached_imp.c:237:36:cmemcached_imp.c:237:36: error: error: libmemcached/memcached.h: No such file or directory
libmemcached/memcached.h: No such file or directory
In file included from cmemcached_imp.c:238:
split_mc.h:14: warning: ‘struct memcached_st’ declared inside parameter list
split_mc.h:14: warning: its scope is only this definition or declaration, which is probably not what you want
split_mc.h:17: warning: ‘struct memcached_st’ declared inside parameter list
In file included from cmemcached_imp.c:238:
split_mc.h:14: warning: ‘struct memcached_st’ declared inside parameter list
(and this goes on for many many more lines)...

最佳答案

错误是因为文件cmemcached_imp.c不存在,而必须在这一步编译。

首先,编辑文件 cmemcached_imp.pyx 并修正第 506 行的拼写错误。而不是

sys.stderr.write("[cmemcached]%s only support string: %s" % (cmd, key))

,应该是

sys.stderr.write("[cmemcached]%s only support string: %s" % (cmd, keys))

然后,安装cython并执行

$ cython cmemcached_imp.pyx

cython 应该静默生成文件 cmemcached_imp.c

虽然这会修复即时错误,但您可能还需要替换

ext_modules=[Extension('cmemcached_imp',
['cmemcached_imp.pyx', 'split_mc.c'],

setup.py

ext_modules=[Extension('cmemcached_imp',
['cmemcached_imp.c', 'split_mc.c'],

响应编辑:

如果您逐字按照说明进行操作,您还需要在本地目录中安装 libmemcached。执行

$ ln -s $(pwd)/../libmemcached-0.40/libmemcached

在 python-libmemcached 中实现这一点。

关于python - 安装 libmemcached 时 gcc 失败,退出状态为 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7629937/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com