当我使用pip安装mysqlclient时,它显示找不到mysql_config:
[root@iZus9gnp1cZ local]# pip install mysqlclient Collecting mysqlclient Downloading http://mirrors.aliyun.com/pypi/packages/6f/86/bad31f1c1bb0cc99e88ca2adb7cb5c71f7a6540c1bb001480513de76a931/mysqlclient-1.3.12.tar.gz (89kB)
100% |████████████████████████████████| 92kB 13.0MB/s
Complete output from command python setup.py egg_info:
sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-OJR4Al/mysqlclient/setup.py", line 17, in <module>
metadata, options = get_config()
File "setup_posix.py", line 44, in get_config
libs = mysql_config("libs_r")
File "setup_posix.py", line 26, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-OJR4Al/mysqlclient/
谷歌之后,我找到一些建议 sudo yum install python-devel mysql-devel
但它不起作用:
[root@iZus9gnp1cZ local]# yum install python-devel mysql-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package python-devel-2.7.5-58.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package mariadb-devel.x86_64 1:5.5.56-2.el7 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.56-2.el7 for package: 1:mariadb-devel-5.5.56-2.el7.x86_64
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.56-2.el7 will be installed
Removing mariadb-libs.x86_64 1:5.5.56-2.el7 - u due to obsoletes from installed mysql-community-libs-5.7.20-1.el7.x86_64
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.56-2.el7 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.56-2.el7 for package: 1:mariadb-devel-5.5.56-2.el7.x86_64
--> Finished Dependency Resolution
Error: Package: 1:mariadb-devel-5.5.56-2.el7.x86_64 (base)
Requires: mariadb-libs(x86-64) = 1:5.5.56-2.el7
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
我的centos版本是7.3,python 3.4.2
答案 0 :(得分:0)
我在安装mysql之前重新安装它,它的工作原理! 我想这个命令&#39; yum -y删除mysql57-community-release-el7-10.noarch&#39;破坏环境文件。