错误:为MySQLpython构建wheel失败

2024-03-28 19:55:25 发布

您现在位置:Python中文网/ 问答频道 /正文

为了满足遗留Django应用程序的需求,我需要在debian9上的一个新的virtualenv上安装MySQL-python==1.2.5。但是当我跑的时候

pip install 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.

这里有a similar question,但是那里的建议对我没有用。在


Tags: installpippysupportforincludesetupmysql