Python MySQL wrong architecture error

后端 未结 12 2202

I\'ve been at this for some time and read many sites on the subject. suspect I have junk lying about causing this problem. But where?

This is the error when I impor

12条回答
  •  -上瘾入骨i
    2020-12-08 05:16

    I just struggled with the same, despite the many answers, so I'll risk adding another:

    • Run python -c 'import platform; print platform.platform()'. Does it end in "64 bit"?
    • Do ls -l /usr/local/mysql. It's a symlink: does it end in "x86_64"?

    If python says "64 bit", then you want mysql for "x86_64" (search for that at http://dev.mysql.com/downloads/mysql/). If python says "32 bit", then you probably want the "x86" mysql. If you have a match, but it still doesn't work, then read the other answers (about VERSIONER_PYTHON_PREFER_32_BIT etc.)

    For me, the mismatch caused the "mach-o, but wrong architecture" error. The next error was "Library not loaded: libmysqlclient.18.dylib... Reason: image not found".

    To solve this one, I recommend adding a symlink (rather than set DYLD_LIBRARY_PATH, as explained in other answers):

    sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/lib/
    

提交回复
热议问题