Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
错误:为MySQL python构建控制盘失败_Python_Mysql_Python 2.7_Mysql Python - Fatal编程技术网

错误:为MySQL python构建控制盘失败

错误:为MySQL python构建控制盘失败,python,mysql,python-2.7,mysql-python,Python,Mysql,Python 2.7,Mysql Python,为了满足传统Django应用程序的要求,我需要在Debian 9上的新VirtualNV上安装MySQL python==1.2.5。但是当我跑的时候 pip安装MySQL-python==1.2.5 我得到这个错误: $ pip install MySQL-python==1.2.5 DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as

为了满足传统Django应用程序的要求,我需要在Debian 9上的新VirtualNV上安装
MySQL python==1.2.5
。但是当我跑的时候

pip安装MySQL-python==1.2.5

我得到这个错误:

$ pip install MySQL-python==1.2.5
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting MySQL-python==1.2.5
  Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
Building wheels for collected packages: MySQL-python
  Building wheel for MySQL-python (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/bob/.dj/bin/python2 -u -c 'import sys, setuptools, ...
  ----------------------------------------
  ERROR: Failed building wheel for MySQL-python
 ...
    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:440: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
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/bob/.dj/bin/python2 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-29DwM6/MySQL-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-29DwM6/MySQL-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-nI8a9C/install-record.txt --single-version-externally-managed --compile --install-headers /home/bob/.dj/include/site/python2.7/MySQL-python Check the logs for full command output.
$pip安装MySQL python==1.2.5
弃用:Python 2.7将于2020年1月1日结束其使用寿命。请升级您的Python,因为Python 2.7将在该日期后不再维护。pip的未来版本将放弃对Python2.7的支持。有关pip中Python 2支持的更多详细信息,请访问https://pip.pypa.io/en/latest/development/release-process/#python-2-支持
正在收集MySQL python==1.2.5
使用缓存https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
为收集的包构建控制盘:MySQL-python
正在为MySQL python构建控制盘(setup.py)。。。错误
错误:命令出错,退出状态为1:
命令:/home/bob/.dj/bin/python2-u-c'import sys,setuptools。。。
----------------------------------------
错误:为MySQL python构建控制盘失败
...
在_mysql.c:44中包含的文件中:
/usr/include/mariadb/my_config.h:3:2:warning:#警告客户端不应包含此文件,仅包含[-Wcpp]
#警告:客户端不应包括此文件,仅包括
^~~~~~~
在_mysql.c:46中包含的文件中:
/usr/include/mariadb/mysql.h:440:3:警告:函数声明不是原型[-Wstrict-prototype]
MYSQL\u客户端\u插件\u头
^~~~~~~~~~~~~~~~~~~~~~~~~~
_c:在函数“\u mysql\u ConnectionObject\u ping”中:
_mysql.c:2005:41:错误:'mysql'{aka'struct st_mysql'}没有名为'reconnect'的成员
如果(重新连接!=-1)自->连接。重新连接=重新连接;
^
错误:命令“x86_64-linux-gnu-gcc”失败,退出状态为1
----------------------------------------
错误:命令出错,退出状态为1:/home/bob/.dj/bin/python2-u-c'import sys,setuptools,tokenize;sys.argv[0]=“””/tmp/pip-install-29DwM6/MySQL-python/setup.py“”__文件\ \='''''''/tmp/pip-install-29DwM6/MySQL-python/setup.py''';f=getattr(标记化,“'open'”,open)(\uuuuu文件);code=f.read().replace(“\r\n”“”、“\n”“”);f、 close();exec(compile(code,“'exec'”)'install--record/tmp/pip-record-nI8a9C/install-record.txt--外部管理的单一版本--compile--install headers/home/bob/.dj/include/site/python2.7/MySQL-python检查日志以获得完整的命令输出。

是的,但是那里的建议对我不起作用

我也有同样的问题。我猜
mysql-python
依赖于来自mysql驱动程序(或库?)的一些文件

  • 确保你不会像我一样在Debian中跑步。官方python映像,例如 是建立在Debian之上的。事实证明,Debian 10是与MariaDB一起提供的,它的API和Mysql的API之间存在一些差异

  • 对于其他人,您可以尝试以下命令以查看其是否有效

    Mac上的
    #
    brew安装mysql-connector-c
    brew安装mysql@5.7
    #在Ubuntu上
    apt get install-y默认libmysqlclient dev