SoFunction
Updated on 2024-10-30

Troubleshooting Ubuntu pip installation errors for mysql-python packages

The problem description is as follows, reporting that the mysql_config environment variable was not found

$ pip install mysql-python

Collecting MySQL-python==1.2.5 (from -r requirement (line 16))
 Downloading MySQL-python-1.2. (108kB)
100% |################################| 112kB 56kB/s 
Complete output from command python  egg_info:
sh: mysql_config: command not found
Traceback (most recent call last):
 File "<string>", line 1, in <module>
 File "/tmp/pip-build-HVEeJz/MySQL-python/", line 17, in <module>
 metadata, options = get_config()
 File "setup_posix.py", line 43, in get_config
 libs = mysql_config("libs_r")
 File "setup_posix.py", line 25, in mysql_config
 raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found

----------------------------------------
Command "python  egg_info" failed with error code 1 in /tmp/pip-build-HVEeJz/MySQL-python/

Solution:

Because the dependencies are not installed

Ubuntu/Debian

sudo apt-get install libmysqlclient-dev

The above article to solve the problem of Ubuntu pip installation mysql-python package error is all that I have shared with you, I hope to give you a reference, and I hope that you will support me more.