Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python - pip install mysqlclient on Arch Linux

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.

like image 344
Forinstance Avatar asked Apr 13 '26 15:04

Forinstance


2 Answers

In the end the solution was to install gcc and mysql

pacman -S gcc

pacman -S mysql 

and just later run

pip install mysqlclient
like image 163
Forinstance Avatar answered Apr 17 '26 09:04

Forinstance


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

like image 45
Matthew Gaiser Avatar answered Apr 17 '26 10:04

Matthew Gaiser



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!