我在Mac OS Lion上遇到pylibmc问题。
libmemcached - 1.0.4
pylibmc - 1.2.3
$ python
Python 2.7.1 (r271:86832, Jun 25 2011, 05:09:01)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylibmc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/pylibmc/__init__.py", line 70, in <module>
import _pylibmc
ImportError: dlopen(/Library/Python/2.7/site-packages/_pylibmc.so, 2): Symbol not found: _memcached_add
Referenced from: /Library/Python/2.7/site-packages/_pylibmc.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/_pylibmc.so
但它适用于sudo!
$ sudo python
Password:
Python 2.7.1 (r271:86832, Jun 25 2011, 05:09:01)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylibmc
>>>
有什么想法吗?
答案 0 :(得分:2)
以32位模式安装解决了这个问题。
您需要以32位模式安装libevent
brew install --universal libevent
下载libmemcached源代码(1.0.8版本适用于我)并配置32位arch的强制功能:
./configure --build=i386-apple-darwin11.4.2 "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"
make
sudo make install
其中11.4.2是内核的版本
重新安装pylibmc
sudo pip uninstall pylibmc
sudo pip install pylibmc
现在可行了
$ python -c 'import pylibmc'
$
答案 1 :(得分:0)
看起来像libmemcached的构建和/或安装问题。也许你可以看看问题#101? https://github.com/lericson/pylibmc/issues/101