解决安装mysqlclient出现如下问题:
Complete output from command python setup.py egg_info: /bin/sh: 1: mysql_config: not found Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-7qo1k7as/mysqlclient/setup.py", line 18, in <module> metadata, options = get_config() File "/tmp/pip-install-7qo1k7as/mysqlclient/setup_posix.py", line 53, in get_config libs = mysql_config("libs_r") File "/tmp/pip-install-7qo1k7as/mysqlclient/setup_posix.py", line 28, in mysql_config raise EnvironmentError("%s not found" % (mysql_config.path,)) OSError: mysql_config not found ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-7qo1k7as/mysqlclient/
安装mysql:
sudo apt-get install mysql-server mysql-client 然后mysql -V查看mysql是否安装成功 sudo apt-get install libmysqlclient-dev python3-dev 然后 pip install mysqlclient就不会报错找不到'mysql_config'了 # mysql5.7创建用户并授权: 创建数据库 mysql> CREATE USER 'office'@'%' IDENTIFIED BY 'office'; mysql> CREATE DATABASE office DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; mysql> grant all privileges on office.* to office@'%' identified by 'office'; mysql> flush privileges;
修改密码:
set password for root@'localhost'=password('xxxx'); 注意@'localhost不能省略 ```
本文主要摘自:https://www.cnblogs.com/lajiao/p/9176060.html