Home  >  Article  >  Database  >  How to Resolve \"sh: mysql_config: not found\" Error During MySQL-python Installation on Ubuntu?

How to Resolve \"sh: mysql_config: not found\" Error During MySQL-python Installation on Ubuntu?

Barbara Streisand
Barbara StreisandOriginal
2024-11-02 22:26:30543browse

How to Resolve

Troubleshooting MySQL-python Installation on Ubuntu

In an attempt to install MySQL-python on Ubuntu/Linux, an error indicating "sh: mysql_config: not found" was encountered. To resolve this issue and ensure a successful installation, consider the following suggestions:

Recommended Approach:

Ubuntu users are advised to utilize the distribution's repository for installing MySQL-python. The following command should facilitate the process:

sudo apt-get install python-mysqldb

Alternative Using Pip:

If you prefer using pip for installation, follow these steps:

  1. Refer to the following question and answer for assistance in resolving the mysql-config not found error: https://stackoverflow.com/questions/9276881/pip-install-mysql-python-fails-with-environmenterror-mysql-config-not-found
  2. Consult the comprehensive guide provided by the developer: http://mysql-python.blogspot.no/2012/11/is-mysqldb-hard-to-install.html
  3. To obtain the necessary prerequisites for installing python-mysqldb via pip (especially if using virtualenv), execute the following command:
sudo apt-get install build-essential python-dev libmysqlclient-dev

The above is the detailed content of How to Resolve \"sh: mysql_config: not found\" Error During MySQL-python Installation on Ubuntu?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn