在centos上安装mysqlpython时出错

2024-09-27 20:18:53 发布

您现在位置:Python中文网/ 问答频道 /正文

Running setup.py install for mysql-python
building '_mysql' extension
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,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 -g -m64 -fPIC -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing
In file included from _mysql.c:44:0:
/usr/include/mysql/my_config.h:441:0: warning: "HAVE_WCSCOLL" redefined [enabled by default]
 #define HAVE_WCSCOLL
 ^
In file included from /usr/include/python2.7/pyconfig.h:6:0,
                 from /usr/include/python2.7/Python.h:8,
                 from _mysql.c:29:
/usr/include/python2.7/pyconfig-64.h:911:0: note: this is the location of the previous definition
 #define HAVE_WCSCOLL 1
 ^
gcc -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib64 -L/usr/lib64 -lmysqlclient -lpthread -lm -ldl -lpython2.7 -o build/lib.linux-x86_64-2.7/_mysql.so
/usr/bin/ld: cannot find -lmysqlclient
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Complete output from command /root/working/falcon/dashboard/env/bin/python -c "import setuptools;__file__='/root/working/falcon/dashboard/env/build/mysql-python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-gksvOd-record/install-record.txt --single-version-externally-managed --install-headers /root/working/falcon/dashboard/env/include/site/python2.7:
running install
running build
running build_py
creating build

creating build/lib.linux-x86_64-2.7
……

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,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 -g -m64 -fPIC -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing
In file included from _mysql.c:44:0:
/usr/include/mysql/my_config.h:441:0: warning: "HAVE_WCSCOLL" redefined [enabled by default]
 #define HAVE_WCSCOLL
In file included from /usr/include/python2.7/pyconfig.h:6:0,
             from /usr/include/python2.7/Python.h:8,
             from _mysql.c:29:
/usr/include/python2.7/pyconfig-64.h:911:0: note: this is the location of the previous definition

 #define HAVE_WCSCOLL 1
gcc -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib64 -L/usr/lib64 -lmysqlclient -lpthread -lm -ldl -lpython2.7 -o build/lib.linux-x86_64-2.7/_mysql.so

/usr/bin/ld: cannot find -lmysqlclient

collect2: error: ld returned 1 exit status

error: command 'gcc' failed with exit status 1

Centos7和MySQL5.6.36
我尝试在virtualenv中安装pip_需求
在mysql python中,它不起作用
我尝试安装mysql连接器python,但它不起作用

ImportError: No module named MySQLdb
gcc-c++-4.8.5-16.el7_4.1.x86_64
libgcc-4.8.5-16.el7_4.1.x86_64
gcc-4.8.5-16.el7ˉ4.1.x86_64
gcc-gfortran-4.8.5-16.el7_4.1.x86_64


Tags: frombuildsourceincludelinuxusrhavemysql

热门问题