Mysqldb не устанавливается в виртуальной среде python2 - PullRequest
0 голосов
/ 24 февраля 2020

Я пытаюсь установить Mysqldb в python2 env и пробовал следующие вещи.

Таким образом, была первоначальная ошибка:

    #include "my_config.h"
             ^~~~~~~~~~~~~
   compilation terminated.
   error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Затем я попробовал эти

sudo apt-get install python-mysqldb
sudo apt-get install python-pip python-dev libmysqlclient-dev
sudo apt-get install libssl-dev

Не было изменений в ошибке, и затем я попробовал это sudo apt install default-libmysqlclient-dev

, а ошибка теперь

 In file included from _mysql.c:44:
   /usr/include/mariadb/my_config.h:3:2: warning: #warning This file should not be included by clients, include only <mysql.h> [-Wcpp]
    #warning This file should not be included by clients, include only <mysql.h>
     ^~~~~~~
   In file included from _mysql.c:46:
   /usr/include/mariadb/mysql.h:444:3: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
      MYSQL_CLIENT_PLUGIN_HEADER
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   _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 'x86_64-linux-gnu-gcc' failed with exit status 1

Может ли кто-нибудь помочь настроить mysqldb в python2 virtualenv

1 Ответ

0 голосов
/ 28 февраля 2020

Нашел ответ в здесь .

pip install mysqlclient==1.4.6

Работает.

...