Home > Database > Mysql Tutorial > How Do I Install the MySQLdb Module for Python using pip?

How Do I Install the MySQLdb Module for Python using pip?

Patricia Arquette
Release: 2024-12-11 05:37:11
Original
968 people have browsed it

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
Copy after login

For legacy versions of Python (1.2.x), use this command instead:

pip install MySQL-python
Copy after login

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
Copy after login

Fedora 24:

sudo dnf install python python-devel mysql-devel redhat-rpm-config gcc
Copy after login

Mac OS:

Start by running this command:

brew install mysql-connector-c
Copy after login

If that fails, try this alternative:

brew install mysql
Copy after login

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!

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