Mysql
 sql >> Database >  >> RDS >> Mysql

Errore di architettura errata di Python MySQL

Ho un MacBook Air nuovo e sono riuscito a far funzionare MySQLdb procedendo come segue:(Snow Leopard 10.6.6, Python preinstallato)

uname -a
Darwin Braindamage.local 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386

Scarica il file dmg MySQL a 32 bit dalle pagine mysql, installalo.

Aggiungi le seguenti righe al tuo ~/.profile (o ~/.bash_profile):

PATH="/usr/local/mysql/bin:${PATH}"
export PATH
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
export VERSIONER_PYTHON_PREFER_64_BIT=no
export VERSIONER_PYTHON_PREFER_32_BIT=yes

Dopo aver salvato, digita quanto segue nel terminale:source ~/.profile

Scarica MySQL-python-1.2.3.tar.gz unzip, untar, cd in quella directory

python2.5 setup.py build
sudo python2.5 setup.py install

esci da quella directory (o riceverai un avviso)

python2.5
import MySQLdb

o

python
import MySQLdb

funziona come dovrebbe!!