2017-08-27 111 views
0

我兩者都已安裝python_devel和mysql_devel(即MariaDB的devel的)還是我得到找不到文件的錯誤與PIP安裝的mysql時:錯誤安裝的mysql與MariaDB的10.2

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 
[email protected] [~]# 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 

瑪麗亞和mysql的頭是有該文件是不是:

[email protected] [~]# 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/ 
[email protected] [~]# 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 
[email protected] [~]# 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 
[email protected] [~]# 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 
+0

有'/ usr/include/mysql/my_config.h'嗎?或在另一個目錄? – phd

+0

更新的問題,該文件不存在。 – frisco

+0

它必須在那裏。例如[見RPM文件列表](https://rpmfind.net/linux/RPM/centos/7.3.1611/x86_64/Packages/mariadb-devel-5.5.52-1.el7.x86_64.html) 。重新安裝'MariaDB-devel'並再次驗證文件。 – phd

回答

3

最後這個固定在的mysql的devel的分支,但尚未發佈,這是由於在MariaDB的10.2.8最近的變化,它改變了服務器頭的位置到/ server文件夾以避免碰撞heade rs來自服務器和客戶端。

+1

一個替代方案是做一個'pip安裝git + https:// github .com/PyMySQL/mysqlclient-python.git'與此同時,我們正在等待下一個版本,我在我的項目中這樣做。 –