异常如下:
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/opt/py27/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o
gcc -pthread -shared build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib -lmysqlclient -lpthread -lm -lrt -ldl -o build/lib.linux-x86_64-2.7/_mysql.so
/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/ld: cannot find -lmysqlclient
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/data/bkce/.envs/bkdata-dataapi/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-uwyoHv/MySQL-python/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-IQ4VNe-record/install-record.txt --single-version-externally-managed --compile --install-headers /data/bkce/.envs/bkdata-dataapi/include/site/python2.7/MySQL-python" failed with error code 1 in /tmp/pip-build-uwyoHv/MySQL-python/
[192.168.100.203]20201014-101811 177 pip install (--no-cache-dir --no-index --find-links=/data/src/bkdata/support-files/pkgs) for bkdata-dataapi. FAILED
[192.168.100.203]20201014-101811 47 Abort
解决方案:
这是由于缺少/usr/lib/缺少libmysqlclient.so导致,需要做一个链接
ln -s /usr/lib64/mysql/libmysqlclient.so /usr/lib/
确认结果:
[root@rbtnode1 install]# ls /usr/lib/ | grep mysql
libmysqlclient.so