dongnan
总版主
总版主
  • 粉丝52
  • 发帖数2168
  • 铜币13301枚
  • 威望5857点
  • 银元150个
  • 社区居民
  • 最爱沙发
  • 忠实会员
  • 原创写手
阅读:1029回复:0

[python] OSError: mysql_config not found

楼主#
更多 发布于:2018-02-07 16:55
问题描述
使用 pip安装 mysqlclient 模块时出现“OSError: mysql_config not found”错误。

环境
# 版本
Anaconda3 On Docker
python -V
Python 3.6.3 :: Anaconda, Inc.

#系统
head -n1 /etc/issue
Debian GNU/Linux 8 \n \l

解决方式
apt-get install libmysqlclient-dev

验证

pip install mysqlclient
...省略
Successfully built mysqlclient
Installing collected packages: mysqlclient
Successfully installed mysqlclient-1.3.12

扩展
目前,python有两个常用的 MySQL驱动:

1. Python interface to MySQL
mysqlclient is a fork of MySQL-python. It adds Python 3 support and fixed many bugs.
MySQLdb is an interface to the popular MySQL database server for Python. The design goals are:
    Compliance with Python database API version 2.0 [PEP-0249]
    Thread-safety
    Thread-friendliness (threads will not block each other)
MySQL-5.5 through 5.7 and Python 2.7, 3.4+ are currently supported. PyPy is supported too.

2. PyMySQL
Pure Python MySQL Driver
This package contains a pure-Python MySQL client library. The goal of PyMySQL is to be a drop-in replacement for MySQLdb and work on CPython, PyPy and IronPython.

#
游客

返回顶部