gnu linux mysql下载_install mysqlclient(任何一个模块) error: command 'x86_64-linux-gnu-gcc' failed with exit...

install mysqlclient(任何一个模块) error: command 'x86_64-linux-gnu-gcc' failed with exit status 1?

背景:

系统:ubuntu

python版本:python3.8

错误信息:x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 -I/usr/include/mysql -I/home//work/ark/venv/include -I/usr/include/python3.8 -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.8/MySQLdb/_mysql.o

MySQLdb/_mysql.c:38:10: fatal error: Python.h: No such file or directory

#include "Python.h"

^~~~~~~~~~

compilation terminated.

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------

Command "/home//work/ark/venv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-s6j_00qi/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-uv2smgm6-record/install-record.txt --single-version-externally-managed --compile --install-headers /home//work/ark/venv/include/site/python3.8/mysqlclient" failed with error code 1 in /tmp/pip-build-s6j_00qi/mysqlclient/

解决方法:sudo apt-get install libpython3.8-dev

其他python版本解决方法

对于Python 2.x,请使用:sudo apt-get install python-dev

对于Python 2.7,请使用:sudo apt-get install libffi-dev

对于Python 3.x,请使用:sudo apt-get install python3-dev

对于Python 3.4,请使用:sudo apt-get install python3.4-dev

对于Python 3.5,请使用:sudo apt-get install python3.5-dev

对于Python 3.6,请使用:sudo apt-get install python3.6-dev

对于Python 3.7,请使用:sudo apt-get install python3.7-dev

对于Python 3.8,请使用:sudo apt-get install python3.8-dev

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值