pip报错解决:EnvironmentError: mysql_config not found

Posted zqifa

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pip报错解决:EnvironmentError: mysql_config not found相关的知识,希望对你有一定的参考价值。

centos7下使用python类库mysql-python操作mysql。
pip安装类库:
pip install MySQL-python
报错提示:
mariadb EnvironmentError: mysql_config not found

安装mysql-devel:
yum -y install mysql-devel

执行pip install MySQL-python,又出现报错:
error: command ‘gcc‘ failed with exit status 1

这是由于没有正确安装Python开发环境导致。

Centos/Fedora下
yum install python-devel
yum install libevent-devel
easy_install gevent
或者
pip install gevent
把环境更新下
yum groupinstall ‘development tools‘

如果是Debin/Ubuntu下
Python2:apt-get install python-dev
Python3:apt-get install python3-dev
可能需要libevent库
apt-get install libevent-dev
最后更新下开发环境
apt-get groupinstall ‘development tools‘

再次执行pip install MySQL-python

ps:如果本地已经安装了mysql,要安装和mysql版本匹配的mysql-devel

以上是关于pip报错解决:EnvironmentError: mysql_config not found的主要内容,如果未能解决你的问题,请参考以下文章

[已解决]报错: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/

pip 安装 MySQL-python 报错

pip 安装TensorFlow Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。:

[Python配置]执行pip install出现Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。的解

EnvironmentError: HTTPSConnectionPool 同时在 docker 容器上安装 pip

如何修复 pip install 错误:'EnvironmentError: [Errno 42] Illegal byte sequence'?