安装时候的日志如下:
sh: 1: mysql_config: not found Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-build-KZJ2c6/mysqlclient/setup.py", line 17, in <module> metadata, options = get_config() File "/tmp/pip-build-KZJ2c6/mysqlclient/setup_posix.py", line 44, in get_config libs = mysql_config("libs_r") File "/tmp/pip-build-KZJ2c6/mysqlclient/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-KZJ2c6/mysqlclient/
错误解决方案:
1.检查系统是否安装了libmysqlclient-dev,没有安装的话使用sudo apt-get install libmysqlclient-dev安装
2.sudo updatedb,locate mysql_config找到mysql_config的安装目录/usr/bin/mysql_config
3.在mysql-python源码包下找到:setup_posix.py 文件,然后找到文件中的 mysql_config.path 将其值改为:/usr/bin/mysql_config,然后 sudo python setup.py install
4.重新安装flask-mysqldb pip install flask-mysqldb