Home >Database >Mysql Tutorial >How to Fix \'sh: mysql_config: not found\' Error During MySQL-python Installation on Ubuntu/Linux?

How to Fix \'sh: mysql_config: not found\' Error During MySQL-python Installation on Ubuntu/Linux?

Patricia Arquette
Patricia ArquetteOriginal
2024-11-02 08:22:02800browse

How to Fix

Troubleshooting MySQL-python Installation on Ubuntu/Linux

When attempting to install MySQL-python on Ubuntu/Linux using pip, you may encounter the error "sh: mysql_config: not found." This issue stems from the inability to locate the mysql_config binary, a crucial component for the installation process.

Recommended Approach: Using Ubuntu Repositories

For Ubuntu systems, it is highly recommended to utilize the distribution's repository for installing MySQL-python. This eliminates any potential complications and ensures seamless installation.

<code class="sh">sudo apt-get install python-mysqldb</code>

Alternative Approach: Using pip

If you prefer to use pip for the installation, consider consulting the following resources for detailed guidance:

  • Pip install mysql-python fails with EnvironmentError: mysql_config not found
  • https://mysql-python.blogspot.no/2012/11/is-mysqldb-hard-to-install.html

Prerequisite Installation for pip

To ensure successful installation using pip, install the necessary prerequisites:

<code class="sh">sudo apt-get install build-essential python-dev libmysqlclient-dev</code>

By leveraging the Ubuntu repository or properly installing the prerequisites, you should be able to successfully install MySQL-python on your Ubuntu/Linux system.

The above is the detailed content of How to Fix \'sh: mysql_config: not found\' Error During MySQL-python Installation on Ubuntu/Linux?. 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