使用MariaDB 10.2安装mysqlclient时出错

时间:2017-08-27 12:37:44

标签: python mysql pip mariadb

我已经安装了python_devel和mysql_devel(即MariaDB devel),但是当我用pip安装mysqlclient时,我仍然收到一个找不到文件的错误:

Package python-devel-2.7.5-48.el7.x86_64 already installed and latest version
Package MariaDB-devel-10.2.8-1.el7.centos.x86_64 already installed and latest version
Nothing to do
root@host [~]# pip install mysqlclient
Collecting mysqlclient
  Using cached mysqlclient-1.3.10.tar.gz
Installing collected packages: mysqlclient
  Running setup.py install for mysqlclient ... error
    Complete output from command /usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-WQf5SH/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-moASQ3-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/MySQLdb
    copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
    copying MySQLdb/compat.py -> build/lib.linux-x86_64-2.7/MySQLdb
    copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
    copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
    copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb
    copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
    copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb
    creating build/lib.linux-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
    running build_ext
    building '_mysql' extension
    creating build/temp.linux-x86_64-2.7
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,3,10,'final',0) -D__version__=1.3.10 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o
    _mysql.c:29:23: fatal error: my_config.h: No such file or directory
     #include "my_config.h"
                           ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-WQf5SH/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-moASQ3-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-WQf5SH/mysqlclient/
r

当maria和mysql标题存在时,该文件不是:

root@host [~]# ls -al  /usr/include/mysql
total 188
drwxr-xr-x  5 root root  4096 Aug 23 02:39 ./
drwxr-xr-x 71 root root 12288 Aug 23 16:48 ../
-rw-r--r--  1 root root  3527 Aug 17 06:05 errmsg.h
-rw-r--r--  1 root root  1602 Aug 17 06:05 ma_list.h
-rw-r--r--  1 root root  4329 Aug 17 06:05 ma_pvio.h
-rw-r--r--  1 root root  4111 Aug 17 06:05 ma_tls.h
drwxr-xr-x  2 root root  4096 Aug 23 02:39 mariadb/
-rw-r--r--  1 root root 17223 Aug 17 06:05 mariadb_com.h
-rw-r--r--  1 root root  2593 Aug 17 06:05 mariadb_ctype.h
-rw-r--r--  1 root root  8199 Aug 17 06:05 mariadb_dyncol.h
-rw-r--r--  1 root root 11227 Aug 17 06:05 mariadb_stmt.h
-rw-r--r--  1 root root   852 Aug 17 06:11 mariadb_version.h
drwxr-xr-x  2 root root  4096 Aug 23 02:39 mysql/
-rw-r--r--  1 root root 40532 Aug 17 06:05 mysql.h
-rw-r--r--  1 root root 43551 Aug 17 06:15 mysqld_error.h
drwxr-xr-x  4 root root  4096 Aug 23 02:39 server/
root@host [~]# ls -al  /usr/include/mysql/mariadb
total 12
drwxr-xr-x 2 root root 4096 Aug 23 02:39 ./
drwxr-xr-x 5 root root 4096 Aug 23 02:39 ../
-rw-r--r-- 1 root root 1619 Aug 17 06:05 ma_io.h
root@host [~]# ls -al  /usr/include/mysql/mysql
total 28
drwxr-xr-x 2 root root 4096 Aug 23 02:39 ./
drwxr-xr-x 5 root root 4096 Aug 23 02:39 ../
-rw-r--r-- 1 root root 8560 Aug 17 06:05 client_plugin.h
-rw-r--r-- 1 root root 3793 Aug 17 06:05 plugin_auth.h
-rw-r--r-- 1 root root 3873 Aug 17 06:05 plugin_auth_common.h
root@host [~]# ls -al  /usr/include/mysql/server/
total 656
drwxr-xr-x 4 root root   4096 Aug 23 02:39 ./
drwxr-xr-x 5 root root   4096 Aug 23 02:39 ../
-rw-r--r-- 1 root root   4507 Aug 17 06:05 big_endian.h
-rw-r--r-- 1 root root   5196 Aug 17 06:05 byte_order_generic.h
-rw-r--r-- 1 root root   4239 Aug 17 06:05 byte_order_generic_x86.h
-rw-r--r-- 1 root root   4089 Aug 17 06:05 byte_order_generic_x86_64.h
-rw-r--r-- 1 root root   4667 Aug 17 06:05 decimal.h
-rw-r--r-- 1 root root   4363 Aug 17 06:05 errmsg.h
-rw-r--r-- 1 root root   4441 Aug 17 06:05 handler_ername.h
-rw-r--r-- 1 root root    758 Aug 17 06:05 handler_state.h
-rw-r--r-- 1 root root  13184 Aug 17 06:05 json_lib.h
-rw-r--r-- 1 root root   8827 Aug 17 06:05 keycache.h
-rw-r--r-- 1 root root   3574 Aug 17 06:05 little_endian.h
-rw-r--r-- 1 root root  47238 Aug 17 06:05 m_ctype.h
-rw-r--r-- 1 root root   7745 Aug 17 06:05 m_string.h
-rw-r--r-- 1 root root   7838 Aug 17 06:05 ma_dyncol.h
-rw-r--r-- 1 root root   1944 Aug 17 06:05 my_alloc.h
-rw-r--r-- 1 root root   2208 Aug 17 06:05 my_attribute.h
-rw-r--r-- 1 root root   1980 Aug 17 06:05 my_byteorder.h
-rw-r--r-- 1 root root   4236 Aug 17 06:05 my_compiler.h
-rw-r--r-- 1 root root  14716 Aug 17 06:12 my_config.h
-rw-r--r-- 1 root root   8543 Aug 17 06:05 my_dbug.h
-rw-r--r-- 1 root root   2075 Aug 17 06:05 my_decimal_limits.h
-rw-r--r-- 1 root root   3900 Aug 17 06:05 my_dir.h
-rw-r--r-- 1 root root   5578 Aug 17 06:05 my_getopt.h
-rw-r--r-- 1 root root  34520 Aug 17 06:05 my_global.h
-rw-r--r-- 1 root root   1506 Aug 17 06:05 my_list.h
-rw-r--r-- 1 root root   2104 Aug 17 06:05 my_net.h
-rw-r--r-- 1 root root  27489 Aug 17 06:05 my_pthread.h
-rw-r--r-- 1 root root  42655 Aug 17 06:05 my_sys.h
-rw-r--r-- 1 root root   1982 Aug 17 06:05 my_valgrind.h
-rw-r--r-- 1 root root   2832 Aug 17 06:05 my_xml.h
drwxr-xr-x 3 root root   4096 Aug 23 02:39 mysql/
-rw-r--r-- 1 root root  39711 Aug 17 06:05 mysql.h
-rw-r--r-- 1 root root  28765 Aug 17 06:05 mysql_com.h
-rw-r--r-- 1 root root   1313 Aug 17 06:05 mysql_com_server.h
-rw-r--r-- 1 root root   1167 Aug 17 06:05 mysql_embed.h
-rw-r--r-- 1 root root   2420 Aug 17 06:05 mysql_time.h
-rw-r--r-- 1 root root   1021 Aug 17 06:12 mysql_version.h
-rw-r--r-- 1 root root 117146 Aug 17 06:15 mysqld_ername.h
-rw-r--r-- 1 root root  43551 Aug 17 06:15 mysqld_error.h
-rw-r--r-- 1 root root   1105 Aug 17 06:05 pack.h
drwxr-xr-x 3 root root  12288 Aug 23 02:39 private/
-rw-r--r-- 1 root root   5508 Aug 17 06:05 sql_common.h
-rw-r--r-- 1 root root  14602 Aug 17 06:15 sql_state.h
-rw-r--r-- 1 root root   1350 Aug 17 06:05 sslopt-case.h
-rw-r--r-- 1 root root   2534 Aug 17 06:05 sslopt-longopts.h
-rw-r--r-- 1 root root   1367 Aug 17 06:05 sslopt-vars.h
-rw-r--r-- 1 root root   2463 Aug 17 06:05 typelib.h

1 个答案:

答案 0 :(得分:3)

最后这在mysqlclient的devel分支中修复但尚未发布,这是由于MariaDB 10.2.8最近的更改确实将服务器头的位置更改为/ server文件夹以避免服务器中的头部冲突和客户。