I have a problem with pylibmc on Mac OS Lion.
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
But it works with 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
>>>
Any ideas?
Installation in 32-bit mode solved the problem.
You need to install libevent in 32-bit mode
brew install --universal libevent
Next to download libmemcached source (1.0.8 version works for me) and configure force for 32 bit arch:
./configure --build=i386-apple-darwin11.4.2 "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32" make sudo make install
where 11.4.2 is the version of kernel
Reinstall pylibmc
sudo pip uninstall pylibmc sudo pip install pylibmc
Now it works
$ python -c 'import pylibmc' $
Looks like a build and/or installation problem with libmemcached. Maybe you can check out issue #101? https://github.com/lericson/pylibmc/issues/101
I have similar issue.
I am running macOS with apple silicon. running python 3.7 with x86
interpreter.
after installing libmemcached
with brew install libmemcached
I was able to install pylibmc
with the following command: pip install pylibmc==1.6.0 --install-option="--with-libmemcached=/opt/homebrew/Cellar/libmemcached/1.0.18_2"
but while trying to import pylibmc
it failed with: ImportError: dlopen(.../site-packages/_pylibmc.cpython-37m-darwin.so, 0x0002): symbol not found in flat namespace '_memcached_add'
I am thing that brew install
compiling the library with apple silicon but then i am trying to use it with x86
interpreter. Any suggestions ?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.