Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip install mysqlclient failed: sys/types.h: no such file or directory

Tags:

mysql-python

pip install mysqlclient failed: fatal error: sys/types.h: no such file or directory...command 'gcc' failed with exit status 1

I was creating engine for mysql using sqlalchemy. Got an error "ImportError: No module named MySQLdb". Then I tried to pip install mysqlclient but got this problem. Based on my research sys/types.h is supposed to be found in /usr/include/sys but I don't have include folder in /usr. Tried brew install mysql-connector-c which succeed but didn't fix the problem.

I'm on macOS Mojave(V10.14)

like image 742
minkai Avatar asked Nov 30 '25 00:11

minkai


1 Answers

The following command is proposed in many places, but the latest version does not install header files.

$ xcode-select --install

So, you need to execute the following command to install those headers as well:

$ sudo /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
like image 95
subdiox Avatar answered Dec 01 '25 17:12

subdiox



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!