python mysqlclient 编译错误
怪我咯
怪我咯 2017-04-17 17:07:25
[Python讨论组]

如同,pip install mysqlclient报错如下

pip install mysqlclient
Collecting mysqlclient
  Using cached mysqlclient-1.3.7.tar.gz
Building wheels for collected packages: mysqlclient
  Running setup.py bdist_wheel for mysqlclient
  Complete output from command /root/miniconda2/bin/python -c "import setuptools;__file__='/tmp/pip-build-PN6Mm8/mysqlclient/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpdSux5gpip-wheel-:
  running bdist_wheel
  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/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
  copying MySQLdb/connections.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/CR.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/ER.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
  copying MySQLdb/constants/CLIENT.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 -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,3,7,'final',1) -D__version__=1.3.7 -I/usr/include/mysql -I/root/miniconda2/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -g -fstack-protector -m64 -fPIC -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing
  In file included from /root/miniconda2/include/python2.7/Python.h:8,
                   from _mysql.c:40:
  /root/miniconda2/include/python2.7/pyconfig.h:1194:1: warning: "_POSIX_C_SOURCE" redefined
  In file included from /usr/include/sys/types.h:26,
                   from /usr/include/mysql/mysql.h:47,
                   from _mysql.c:30:
  /usr/include/features.h:162:1: warning: this is the location of the previous definition
  In file included from /root/miniconda2/include/python2.7/Python.h:8,
                   from _mysql.c:40:
  /root/miniconda2/include/python2.7/pyconfig.h:1216:1: warning: "_XOPEN_SOURCE" redefined
  In file included from /usr/include/sys/types.h:26,
                   from /usr/include/mysql/mysql.h:47,
                   from _mysql.c:30:
  /usr/include/features.h:164:1: warning: this is the location of the previous definition
  gcc -pthread -shared -L/root/miniconda2/lib -Wl,-rpath=/root/miniconda2/lib,--no-as-needed build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib64 -L/root/miniconda2/lib -lmysqlclient -lpthread -lm -lrt -ldl -lpython2.7 -o build/lib.linux-x86_64-2.7/_mysql.so
  /usr/bin/ld: cannot find -lmysqlclient
  collect2: ld returned 1 exit status
  error: command 'gcc' failed with exit status 1
  
怪我咯
怪我咯

走同样的路,发现不同的人生

全部回复(2)
ringa_lee

缺少mysql-libs,使用yum的话可以 yum install mysql-libs

大家讲道理

解决了,装个官网的mysql兼容rpm即可

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号