无法在 ubuntu 12.04 下安装 MySQL-python
Unable to install MySQL-python under ubuntu 12.04
我正在尝试在 virtualenv 环境下的 ubuntu 12.04 中安装 mysql-python 模块,但意外遇到以下错误:
building '_mysql' extension
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -fPIC -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1
In file included from /usr/include/mysql/mysql.h:64:0,
from _mysql.c:46:
/usr/include/mysql/mysql/client_plugin.h:97:3: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
In file included from /usr/include/mysql/mysql.h:64:0,
from _mysql.c:46:
/usr/include/mysql/mysql/client_plugin.h:107:3: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
-Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib/x86_64-linux-gnu
-lmysqlclient_r -lpthread -lz -lm -lrt -ldl -o build/lib.linux-x86_64-2.7/_mysql.so
/usr/bin/ld: cannot find -lmysqlclient_r
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
我 运行:
sudo apt-get install mysql-server mysql-client python-mysqldb libmysqlclient-dev python-dev
但没有用。
问题是 libmysqlclient.so 没有 https://github.com/javer/gentoo-overlay/issues/4#issuecomment-30748799
中描述的符号链接
对于我在 Centos 上,问题是 MySQL-python 没有提供 libmysqlclient_r.so 但它有其他编号的版本。通过卸载它并安装 Percona-SQL-devel,python 能够找到库并正确构建 wheel。
我正在尝试在 virtualenv 环境下的 ubuntu 12.04 中安装 mysql-python 模块,但意外遇到以下错误:
building '_mysql' extension
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -fPIC -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1
In file included from /usr/include/mysql/mysql.h:64:0,
from _mysql.c:46:
/usr/include/mysql/mysql/client_plugin.h:97:3: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
In file included from /usr/include/mysql/mysql.h:64:0,
from _mysql.c:46:
/usr/include/mysql/mysql/client_plugin.h:107:3: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
-Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib/x86_64-linux-gnu
-lmysqlclient_r -lpthread -lz -lm -lrt -ldl -o build/lib.linux-x86_64-2.7/_mysql.so
/usr/bin/ld: cannot find -lmysqlclient_r
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
我 运行:
sudo apt-get install mysql-server mysql-client python-mysqldb libmysqlclient-dev python-dev
但没有用。
问题是 libmysqlclient.so 没有 https://github.com/javer/gentoo-overlay/issues/4#issuecomment-30748799
中描述的符号链接对于我在 Centos 上,问题是 MySQL-python 没有提供 libmysqlclient_r.so 但它有其他编号的版本。通过卸载它并安装 Percona-SQL-devel,python 能够找到库并正确构建 wheel。