Home > Database > Mysql Tutorial > body text

Why Can\'t I Install MySQL-python on Ubuntu?: Tracing the \'mysql_config not found\' Error

Patricia Arquette
Release: 2024-11-02 05:35:02
Original
674 people have browsed it

Why Can't I Install MySQL-python on Ubuntu?: Tracing the

Troubleshooting MySQL-python Installation on Ubuntu

While attempting to install MySQL-python on an Ubuntu/Linux machine, you encountered an error indicating that 'mysql_config' was not found. This query explores the root of this issue and provides practical solutions.

Problem

You encountered the following error when trying to install MySQL-python via pip:

Traceback (most recent call last):
  File "<string>", line 14, in <module>
  [...]
  File "setup_posix.py", line 24, in mysql_config
    raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
Copy after login

Solution

Using Ubuntu's Package Manager (Recommended)

The recommended method for installing MySQL-python on Ubuntu is to use the distribution repository:

sudo apt-get install python-mysqldb
Copy after login

Using pip (Not Recommended)

If you prefer to install using pip, which is not the suggested approach, follow these steps:

  1. Install prerequisites:

    sudo apt-get install build-essential python-dev libmysqlclient-dev
    Copy after login
  2. Check the installation guide provided by the developer:
    http://mysql-python.blogspot.no/2012/11/is-mysqldb-hard-to-install.html

The above is the detailed content of Why Can\'t I Install MySQL-python on Ubuntu?: Tracing the \'mysql_config not found\' Error. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template