sudo pip install mysqlclient失败,出现著名的mysql\u config path错误数据库是远程mysql rds。我尝试使用yum安装一个本地mysql(我并不需要它),但是这对错误没有帮助
[ec2-user@ip-172-31-95-95 /]$ sudo pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-1.3.12.tar.gz
Complete output from command python setup.py egg_info:
sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-opVvwg/mysqlclient/setup.py", line 17, in <module>
metadata, options = get_config()
File "setup_posix.py", line 44, in get_config
libs = mysql_config("libs_r")
File "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-opVvwg/mysqlclient/
[ec2-user@ip-172-31-95-95 /]$
[ec2-user@ip-172-31-95-95 /]$cat/etc/*-发布
NAME="Amazon Linux AMI"
VERSION="2017.09"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2017.09"
PRETTY_NAME="Amazon Linux AMI 2017.09"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2017.09:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
Amazon Linux AMI release 2017.09
[ec2-user@ip-172-31-95-95 /]$
1条答案
按热度按时间hgtggwj01#
首先,您必须在操作系统上为mysql的编译器做一些初始设置,至少据我所知。
确保有编译器集合
sudo yum install gcc
确保为开发目的配置mysqlsudo yum install -y mysql-devel
尝试重新安装pip install mysqlclient==1.3.12
希望这有帮助,因为它似乎做了我的把戏。我在这里遇到了这个,我发现它相当于ubuntu的sudo apt-get install libmysqlclient-dev