在安装MySQLdb模块的时候,无论是pip还是apt-get都出现如下的错误。
[email protected]:~# cd MySQL-python-1.2.3 [email protected]:~/MySQL-python-1.2.3# python setup.py install sh: mysql_config: not found Traceback (most recent call last): File "setup.py", line 15, in <module> metadata, options = get_config() File "/root/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config libs = mysql_config("libs_r") File "/root/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config raise EnvironmentError("%s not found" % (mysql_config.path,)) EnvironmentError: mysql_config not found
这个是因为缺少libmysqld_dev, libmysqlclient_dev 两个开发包引起的。
在安装过程中直接apt了这两个包,同时修改源代码目录下的setup_posix.py文件,
将mysql_config.path 修改为mysql_config.path="/usr/bin/mysql_config"
再次pip安装成功。
时间: 2024-10-25 05:22:06