Home >Database >Mysql Tutorial >How Do I Install the MySQLdb Module for Python using pip?
Installing the MySQLdb Module for Python using pip
Installing the MySQLdb module for Python using pip is a straightforward process, despite its complex spelling. To successfully install the module, follow these steps:
pip install mysqlclient
For legacy versions of Python (1.2.x), use this command instead:
pip install MySQL-python
Note: Before running the installation command, ensure that the necessary dependencies are in place. Here are some hints for installing these dependencies on different platforms:
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:
Start by running this command:
brew install mysql-connector-c
If that fails, try this alternative:
brew install mysql
The above is the detailed content of How Do I Install the MySQLdb Module for Python using pip?. For more information, please follow other related articles on the PHP Chinese website!