天天看点

mysqlclient安装苦逼之路

我使用的是python3.5,在学习Django,配置数据库时,需要安装mysql驱动。

使用pip安装:

pip3 install mysqlclient
           

报错如下:

Command "python setup.py egg_info" failed with error code 1
           

解决步骤:

1. brew install mysql-connector-c

2. 修改mysql_config

文件位于  which mysql_config

原本的mysql_config文件

# Create config
libs="-L$pkglibdir"
libs="$libs -l "
           

修改为:

# Create options 
libs="-L$pkglibdir"
libs="$libs -lmysqlclient -lssl -lcrypto"
           

3. brew info openssl

4. 最终  pip3 install mysqlclient

原解决方案地址