How to install Python MySQLdb module using pip?

0 votes

How can I install the MySQLdb module for Python using pip?

Aug 20, 2018 in Python by aryya
• 7,350 points

1 answer to this question.

0 votes

It's easy to do, but hard to remember the correct spelling:

pip install mysqlclient

If you need 1.2.x versions (legacy Python only), use pip install MySQL-python

Note: Some dependencies might have to be in place when running the above command. Some hints on how to install these on various 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

brew install mysql-connector-c

if that fails, try

brew install mysql
answered Aug 20, 2018 by charlie_brown
• 7,760 points

Related Questions In Python

0 votes
0 answers

How to install python modules using wheeling format?

Can you show the installation of pyaudio ...READ MORE

Jun 21, 2019 in Python by Waseem
• 4,530 points
+1 vote
1 answer

How to install a module in Python 3.6 ?

If you are using Ubuntu then the ...READ MORE

answered Jun 25, 2019 in Python by Arvind
• 2,980 points
0 votes
1 answer

How to install biopython module in python?

To install biopython on your project, simply ...READ MORE

answered Jul 8, 2019 in Python by Mohammad
• 3,230 points
+1 vote
1 answer

How to install tensorflow using anaconda and python 3.7.1 on windows?

Since I am using python 3.5 so ...READ MORE

answered Aug 19, 2019 in Python by Arvind
• 2,980 points
0 votes
1 answer

How to read photo using cv2 module in python?

Hi@akhtar, Yes, you can read your image in ...READ MORE

answered Apr 9 in Python by MD
• 21,860 points
0 votes
1 answer

How to Install Python packages from local file system folder to virtualenv with pip?

Hello @kartik, You can try the code below: pip ...READ MORE

answered May 11 in Python by Niroj
• 21,270 points
0 votes
2 answers

how to print the current time using python?

print( READ MORE

answered Feb 14, 2019 in Python by Shashank
• 1,370 points
+2 votes
2 answers

How to make a laplacian pyramid using OpenCV python?

down voteacceptTheeThe problem is that you're iterating ...READ MORE

answered Apr 3, 2018 in Python by charlie_brown
• 7,760 points
0 votes
1 answer

How to sort Counter by value using python?

Use the Counter.most_common() method, it'll sort the items for you: >>> ...READ MORE

answered May 22, 2018 in Python by charlie_brown
• 7,760 points