Home >Database >Mysql Tutorial >How Do I Install the Python MySQLdb Module Using Pip?

How Do I Install the Python MySQLdb Module Using Pip?

Patricia Arquette
Patricia ArquetteOriginal
2024-12-11 10:11:13302browse

How Do I Install the Python MySQLdb Module Using Pip?

Installing Python MySQLdb Module with Pip

To effectively install the MySQLdb module using pip, follow these steps:

pip install mysqlclient

For legacy Python versions, install the MySQL-python module:

pip install MySQL-python

Dependencies

Before running the installation command, ensure the following dependencies are in place:

Ubuntu 14, Ubuntu 16, Debian 8.6 (jessie):

sudo apt-get install python-pip python-dev libmysqlclient-dev

Fedora 24:

sudo dnf install python python-devel mysql-devel redhat-rpm-config gcc

Mac OS:

brew install mysql-connector-c

If the mysql-connector-c installation fails, try:

brew install mysql

The above is the detailed content of How Do I Install the Python MySQLdb Module Using Pip?. 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