【问题标题】:Mysqldb not installing in python2 virtual envmysqldb没有安装在python2 virtualenv上
【发布时间】:2020-06-08 08:56:15
【问题描述】:

我正在尝试在 python2 环境中安装 Mysqldb 并尝试了以下操作。

这就是最初的错误:

    #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

有人可以帮助在 python2 virtualenv 中设置 mysqldb 吗?

【问题讨论】:

    标签: python mysql linux mysql-python


    【解决方案1】:

    here找到答案。

    pip install mysqlclient==1.4.6
    

    有效。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-11-27
      • 2017-03-01
      • 2011-07-02
      • 2012-04-26
      • 1970-01-01
      • 2015-07-29
      • 2014-03-24
      • 2015-12-13
      相关资源
      最近更新 更多