6

I am trying to install mysqlclient for python, but I always get this error when I try:

$ pip3 install mysqlclient

error

How can I resolve this issue?

marsnebulasoup
  • 2,530
  • 2
  • 16
  • 37
Hasan Bilal
  • 143
  • 2
  • 7

1 Answers1

22

Looking at the error message, it seems that there is an OS Error, and judging by the terminal layout, you're using Linux.

It seems that to install this package on Linux, there are extra instructions to follow, mentioned on the module's github page:

You may need to install the Python 3 and MySQL development headers and libraries like so:

  • $ sudo apt-get install python3-dev default-libmysqlclient-dev build-essential # Debian / Ubuntu
  • % sudo yum install python3-devel mysql-devel # Red Hat / CentOS

Then you can install mysqlclient via pip now:

$ pip install mysqlclient

marsnebulasoup
  • 2,530
  • 2
  • 16
  • 37