繁体   English   中英

Mysqldb未安装在python2虚拟环境中

[英]Mysqldb not installing in python2 virtual env

我正在尝试在 python2 env 中安装 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 吗?

这里找到了答案。

pip install mysqlclient==1.4.6

有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM