I'm going to build a docker image by the following Dockerfile:
FROM python:2.7-alpine
RUN set -ex \
&& apk --no-cache add --virtual build-dependencies \
&& pip install --no-cache-dir mysql-python
It downloads the package via:
Downloading https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB)
and executes
python setup.py install
but it failes and returns the following error:
_mysql.c: In function '_mysql_ConnectionObject_ping':
_mysql.c:2005:41: error: 'MYSQL {aka struct st_mysql}' has no member named 'reconnect'
if ( reconnect != -1 ) self->connection.reconnect = reconnect;
^
error: command 'gcc' failed with exit status 1
but when I try with:
FROM python:2.7
it prefectly works. any idea?
Solution is to use mysqlclient package instead of MySQL-python, it's a fork that solves multiple issues current MySQL-python has.
https://github.com/PyMySQL/mysqlclient-python
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With