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!