前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >centos7 mysqlclient ERROR: Command errored out with exit status 1: python setup.py egg_info Check th

centos7 mysqlclient ERROR: Command errored out with exit status 1: python setup.py egg_info Check th

作者头像
卓越笔记
发布2023-02-18 14:17:33
4540
发布2023-02-18 14:17:33
举报
文章被收录于专栏:卓越笔记

安装环境

django 2.2

centos 7

错误日志

代码语言:javascript
复制
pip install mysqlclient
代码语言:javascript
复制
(qingjiu) [root@VM_16_3_centos running]# pip install mysqlclient
Looking in indexes: http://mirrors.tencentyun.com/pypi/simple
Collecting mysqlclient
  Downloading http://mirrors.tencentyun.com/pypi/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz (85 kB)
     |████████████████████████████████| 85 kB 829 kB/s 
    ERROR: Command errored out with exit status 1:
     command: /root/.pyenvs/qingjiu/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-0ibh1u6c/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-0ibh1u6c/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-install-0ibh1u6c/mysqlclient/pip-egg-info
         cwd: /tmp/pip-install-0ibh1u6c/mysqlclient/
    Complete output (12 lines):
    /bin/sh: mysql_config: command not found
    /bin/sh: mariadb_config: command not found
    /bin/sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-0ibh1u6c/mysqlclient/setup.py", line 16, in <module>
        metadata, options = get_config()
      File "/tmp/pip-install-0ibh1u6c/mysqlclient/setup_posix.py", line 61, in get_config
        libs = mysql_config("libs")
      File "/tmp/pip-install-0ibh1u6c/mysqlclient/setup_posix.py", line 29, in mysql_config
        raise EnvironmentError("%s not found" % (_mysql_config_path,))
    OSError: mysql_config not found
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

解决方法

代码语言:javascript
复制
yum install mysql-devel
代码语言:javascript
复制
(qingjiu) [root@VM_16_3_centos running]# yum install mysql-devel
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package mariadb-devel.x86_64 1:5.5.64-1.el7 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.64-1.el7 for package: 1:mariadb-devel-5.5.64-1.el7.x86_64
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.52-1.el7 will be updated
---> Package mariadb-libs.x86_64 1:5.5.64-1.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================
 Package                           Arch                       Version                            Repository              Size
==============================================================================================================================
Installing:
 mariadb-devel                     x86_64                     1:5.5.64-1.el7                     os                     755 k
Updating for dependencies:
 mariadb-libs                      x86_64                     1:5.5.64-1.el7                     os                     759 k

Transaction Summary
==============================================================================================================================
Install  1 Package
Upgrade             ( 1 Dependent package)

Total download size: 1.5 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/2): mariadb-libs-5.5.64-1.el7.x86_64.rpm                                                            | 759 kB  00:00:00     
(2/2): mariadb-devel-5.5.64-1.el7.x86_64.rpm                                                           | 755 kB  00:00:00     
------------------------------------------------------------------------------------------------------------------------------
Total                                                                                         2.5 MB/s | 1.5 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : 1:mariadb-libs-5.5.64-1.el7.x86_64                                                                         1/3 
  Installing : 1:mariadb-devel-5.5.64-1.el7.x86_64                                                                        2/3 
  Cleanup    : 1:mariadb-libs-5.5.52-1.el7.x86_64                                                                         3/3 
  Verifying  : 1:mariadb-devel-5.5.64-1.el7.x86_64                                                                        1/3 
  Verifying  : 1:mariadb-libs-5.5.64-1.el7.x86_64                                                                         2/3 
  Verifying  : 1:mariadb-libs-5.5.52-1.el7.x86_64                                                                         3/3 

Installed:
  mariadb-devel.x86_64 1:5.5.64-1.el7                                                                                         

Dependency Updated:
  mariadb-libs.x86_64 1:5.5.64-1.el7                                                                                          

Complete!

重新安装

代码语言:javascript
复制
(qingjiu) [root@VM_16_3_centos running]# pip install mysqlclient
Looking in indexes: http://mirrors.tencentyun.com/pypi/simple
Collecting mysqlclient
  Downloading http://mirrors.tencentyun.com/pypi/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz (85 kB)
     |████████████████████████████████| 85 kB 425 kB/s 
Building wheels for collected packages: mysqlclient
  Building wheel for mysqlclient (setup.py) ... done
  Created wheel for mysqlclient: filename=mysqlclient-1.4.6-cp36-cp36m-linux_x86_64.whl size=96094 sha256=37e8b9aa00f7dc1e14388717188583be13fe35dc904e4b383d63396858bf7153
  Stored in directory: /root/.cache/pip/wheels/4e/4e/1f/3546c278052537a8d28dc582b554d9697e477251750746251a
Successfully built mysqlclient
Installing collected packages: mysqlclient
Successfully installed mysqlclient-1.4.6

可能还需要

如果还提示:

OSError: mysql_config not found

就试试:

代码语言:javascript
复制
ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020-3-30 1,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 安装环境
  • 错误日志
  • 解决方法
  • 重新安装
  • 可能还需要
相关产品与服务
云数据库 MySQL
腾讯云数据库 MySQL(TencentDB for MySQL)为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。其具备6大企业级特性,包括企业级定制内核、企业级高可用、企业级高可靠、企业级安全、企业级扩展以及企业级智能运维。通过使用腾讯云数据库 MySQL,可实现分钟级别的数据库部署、弹性扩展以及全自动化的运维管理,不仅经济实惠,而且稳定可靠,易于运维。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档