1.現象;
python
gcc -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib64 -L/usr/lib64 -lmysqlclient_r -lpthread -lm -lrt -ldl -lpython2.7 -o build/lib.linux-x86_64-2.7/_mysql.so /usr/bin/ld: cannot find -lmysqlclient_r collect2: error: ld returned 1 exit status error: command 'gcc' failed with exit status 1
2.mysql
/usr/bin/ld: cannot find -lmysqlclient_r
這個能夠看出是找不到mysqlclient_r文件或函數;linux
從現象的第一行看出是在/usr/lib64 路徑下找mysqlclient_rsql
3.解決方法(copy文件到/usr/lib64/路徑下):python2.7
#cp /usr/lib64/mysql/libmysqlclient_r.a /usr/lib64/函數
4.能夠正常安裝mysql-ptyhon
#pip install mysql-python
ui