Python MySQL wrong architecture error

后端 未结 12 2207

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条回答
  •  轮回少年
    2020-12-08 05:13

    It appears that this issue is related to the version of mysql that you have on the box. When compiling the python mysql component it uses mysql_config which usually lives in /usr/local/mysql/bin to determine what flags to pass to CC when compiling the mysql component. If you have a 32 bit version of mysql running then you will get a 32 version of this component even if you have the 64 bit version of python. As an example I had the following version of mysql...

    /usr/local/mysql-5.5.16-osx10.6-x86 and I should have been running... /usr/local/mysql-5.5.16-osx10.6-x86_64

    Changing over to the 64bit version of mysql on my machine and then running... sudo pip install mysql-python

    fixed the problem for me. You can run the following command to verify how it is going to build the mysql component...

    /usr/local/mysql/bin/mysql_config --cflags

    You should see something like this...

    -I/usr/local/mysql/include -Os -g -fno-common -fno-strict-aliasing -arch x86_64

提交回复
热议问题