2

I need to use MySQLdb in Python 3.7:

import MySQLdb

this should install through the command pip install mysqlclient which however gives me an error on Arch Linux. It seems prerequisites are missing. I see that on other distributions, like Ubuntu, these can be installed via the command:

sudo apt-get install python-dev default-libmysqlclient-dev

Solutions are available for other distro, but I could not find them for Arch Linux.

Forinstance
  • 413
  • 4
  • 17
  • I recommend you do a search using: `pacman -Ss python mysql`, and there you will find the option you want. In general, if the package in pip is called foo in archlinux, the corresponding package is python-foo, in your case it would be: `sudo pacman -S python-mysqlclient` – eyllanesc Sep 11 '19 at 17:41

3 Answers3

6

In the end the solution was to install gcc and mysql

pacman -S gcc

pacman -S mysql 

and just later run

pip install mysqlclient
Forinstance
  • 413
  • 4
  • 17
3

Does it work through pacman? pacman -S python-mysqlclient

Matthew Gaiser
  • 4,558
  • 1
  • 18
  • 35
2

If you install 'python-mysqlclient' with pacman then you can install it without any problem.

  1. pacman -S python-mysqlclient
  2. pip install mysqlclient