CentOS 常见异常及解决办法

1.pip3安装mysqlclient报错python setup.py egg_info Check the logs for full command output.

在CentOS上部署Django项目时,经常需要安装MySQL数据库引擎,如mysqlclient,在执行pip3 install mysqlclient命令时,可能会报错如下:

1ERROR: Command errored out with exit status 1: 2 command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-zmnd8v74/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-zmnd8v74/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-jpy0d_w0 3 cwd: /tmp/pip-install-zmnd8v74/mysqlclient/ 4 Complete output (12 lines): 5 /bin/sh: mysql_config: command not found 6 /bin/sh: mariadb_config: command not found 7 /bin/sh: mysql_config: command not found 8 Traceback (most recent call last): 9 File "<string>", line 1, in <module> 10 File "/tmp/pip-install-zmnd8v74/mysqlclient/setup.py", line 15, in <module> 11 metadata, options = get_config() 12 File "/tmp/pip-install-zmnd8v74/mysqlclient/setup_posix.py", line 65, in get_config 13 libs = mysql_config("libs") 14 File "/tmp/pip-install-zmnd8v74/mysqlclient/setup_posix.py", line 31, in mysql_config 15 raise OSError("{} not found".format(_mysql_config_path)) 16 OSError: mysql_config not found 17 ---------------------------------------- 18ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

这是因为缺少mysql-devel包,需要现进行安装,同时为了解决包版本冲突和依赖冲突,需要先下载并安装mysql的yum源,命令如下:

1# 下载对应版本mysql的yum源的rpm包 2wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm 3 4# 安装rpm包 5rpm -ivh mysql57-community-release-el7-8.noarch.rpm

然后再执行yum install mysql-devel命令安装mysql-devel包,打印如下:

1Loaded plugins: fastestmirror 2mysql-connectors-community | 2.6 kB 00:00:00 3mysql-tools-community | 2.6 kB 00:00:00 4mysql57-community | 2.6 kB 00:00:00 5Loading mirror speeds from cached hostfile 6Resolving Dependencies 7--> Running transaction check 8---> Package mysql-community-devel.x86_64 0:5.7.32-1.el7 will be installed 9--> Finished Dependency Resolution 10

就将mysql-devel包安装成功了。

最后再执行pip3 install mysqlclient命令就可以成功安装mysqlclient引擎。

本文原文首发来自博客专栏Linux开发,由本人转发至https://www.helloworld.net/p/AemQslZIGzh5x,其他平台均属侵权,可点击https://blog.csdn.net/CUFEECR/article/details/109700266查看原文,也可点击https://blog.csdn.net/CUFEECR浏览更多优质原创内容。

点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

皕杰报表之UUID

​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

2020年前端实用代码段,为你的工作保驾护航

有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )