在 Mac 10.14.3上安装 MySQL-Python 的问题

By simon at 2019-05-18 • 0人收藏 • 15人看过

我无法在我的 Mac 上安装 MySQL-python。 我得到的错误如下:

错误: 从命令 / usr / bin / python-u-c'import setuptools,tokenize; file''"'/ private / tmp / pip-install-y 1rowa / mysql-python / setup.py''''''''''''; f getattr (tokenize,''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''(file) ; code f.read ()完成输出。 Replace (''''' r  n''''''''','''''''''') ; f.close () ; exec (compile (code,file,''''''''exec'''''''''))'install -- record / private / tmp / record-qvfg3y / install-single-version-xt-managed-compile: ERROR: running install running install running running build running creating build creating build creating build / lib. Macosx-10.14-intel-2.7复制 mysql exceptions.py-build / lib。 Macosx-10.14-intel-2.7创建 build / lib。 Macosx-10.14-intel-2.7 / MySQLdb 复制 MySQLdb / init。 Py-build / lib. Macosx-10.14-intel-2.7 / MySQLdb 复制 MySQLdb / converters.py-build / lib。 Macosx-10.14-intel-2.7 / MySQLdb 复制 MySQLdb / connections.py-build / lib。 Macosx-10.14-intel-2.7 / MySQLdb 复制 MySQLdb / cursors.py-build / lib。 Macosx-10.14-intel-2.7 / MySQLdb 复制 MySQLdb / release.py-build / lib。 Macosx-10.14-intel-2.7 / MySQLdb 复制 MySQLdb / times.py-build / lib。 Macosx-10.14-intel-2.7 / MySQLdb 创建 build / lib。 Macosx-10.14-intel-2.7 / mysqldb / constants copying mysqldb / constants / init. Py-build / lib. Macosx-10.14-intel-2.7 / mysqldb / constants copying mysqldb / constants / cr.py-build / lib. Macosx-10.14-intel-2.7 / mysqldb / constants copying mysqldb / constants / field type.py-build / lib. Macosx-10.14-intel-2.7 / mysqldb / constants copying mysqldb / constants / er.py-build / lib. Macosx-10.14-intel-2.7 / mysqldb / constants copying mysqldb / constants / flag.py-build / lib. Macosx-10.14-intel-2.7 / mysqldb / constants copy mysqldb / constants / refresh.py-build / lib. Macosx-10.14-intel-2.7 / mysqldb / constants copying mysqldb / constants / client.py-build / lib. Macosx-10.14-intel-2.7 / mysqldb / constants running build ext building'mysql'extension creating build / temp. 句子太长,请短一点。 Framework / versions / 2.7 / include / python2.7-c mysql.c-o build / temp. 句子太长,请短一点。 Mysql. 287:14: warning: implicit conversion loses integer precision:'Py ssize t'(aka'long') to'int'[-Wshorten-64-to-32] cmd argc PySequence size (cmd args) ; ~ ^ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ mysql. 317:12: warning: implicit conversion loses integer precision:'Py ssize t'(aka'long') to'int'[-Wshorten-64-to-32] groupc PySequence size (groups) ; ~ ^ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ mysql. 470:14: warning: implicit conversion loses integer precision:'Py ssize t'(aka'long') to'int'[-Wshorten-64-to-32] int j,n2 PySequence size (fun) ; ~ ^ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ mysql. 1127:9: warning: implicit conversion loses integer precision:'unsigned long'to'int'[-Wshorten-64-to-32] len mysql real escape string (& (self-connection) ,out,in,size) ; ^ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~. 1129:9: warning: implicit conversion loses integer precision:'unsigned long'to'int'[-Wshorten-64-to-32] len mysql escape string (out,in,size) ; ~ ^ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ mysql. C: 1168:9: 警告: 隐式转换失去整数精度:'Py ssize t'(aka'long')转换为'int'[-Wshorten-64-to-32] size PyString get size (s) ; ~ ^ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ / system / library / frameworks / Python。 Framework / versions / 2.7 / include / python2.7 / stringobject. 92:32: note: expanded from macro'PyString get size'# define PyString get size (op) Py size (op) ^ ~ ~ ~ ~ ~ ~ / system / library / frameworks / Python. Framework / versions / 2.7 / include / python2.7 / object. 116:56: note: expanded from macro'Py size'# define Py size (ob)(((PyVarObject *)(ob))-ob size) ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ^ ~ ~ ~ ~ ~ mysql. 1178:9: warning: implicit conversion loses integer precision:'unsigned long'to'int'[-Wshorten-64-to-32] len mysql real escape string (& (self-connection) ,out + 1,in,size) ; ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~. 1180:9: warning: implicit conversion loses integer precision:'unsigned long'to'int'[-Wshorten-64-to-32] len mysql escape string (out + 1,in,size) ; ~ ^ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ mysql. 1274:11: warning: implicit conversion loses integer precision:'Py ssize t'(aka'long') to'int'[-Wshorten-64-to-32] if (n PyObject length (o)-1) goto error; ~ ^ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ / system / library / frameworks / Python. Framework / versions / 2.7 / include / python2.7 / abstract. 434:25: note: expanded from macro'PyObject length'# define PyObject length PyObject object size ^ mysql. 1466:10: warning: implicit conversion loses integer precision:'unsigned long'to'int'[-Wshorten-64-to-32] len strlen (buf) ; ~ ^ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ mysql. 1468:10: warning: implicit conversion loses integer precision:'unsigned long'to'int'[-Wshorten-64-to-32] len strlen (buf) ; ~ ^ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ mysql. 1504:11: warning: implicit conversion loses integer precision:'unsigned long'to'int'[-Wshorten-64-to-32] len strlen (buf) ; ~ ^ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ mysql. C: 1506:11: warning: implicit conversion loses integer precision:'unsigned long'to'int'[-Wshorten-64-to-32] len strlen (buf) ; 生成 ~ ^ ~ ~ ~ ~ ~ ~ ~ 13 warnings。 Cc-bundle-undefined dynamic lookup-Wl,-F. Build / temp. Macosx-10.14-intel-2.7 / mysql.o-l / usr / local / cellar / mysql@5.7 / 5.7.25 / lib-lmysqlclient-lssl-lcrypto-o build / lib. Macosx-10.14-intel-2.7 / mysql.so ld: library not found for-lssl clang: ERROR: linker Command failed with exit code 1(use-v to see invocation) ERROR: Command'cc'failed with exit status 1--------------------------------------------------------------------------------------------------------------------------------------------------. (文件) ; 代码 f.read ()。 替换('''''' r  n''''''''','''''''''') ; f.close () ; exec (compile (code,file,'''''''exec''''''''))'install -- record / private / tmp / record-qvfg3y / install-record.tlt -- single-version-xt-managed -- compile"失败,错误代码1在 / private / tmp / pip / pip-install-y 1rowa / myl-sq/ 

我的 mysql-config 如下:

句子太长,请短一点。 [0] -- port [0] -- version [6.1.11] -- 变量 VAR 是: pkgincludedir [ / usr / local / cellar / mysql-connector-c / 6.1.11 / include ] pkglibdir [ / usr / local / cellar / mysql-connector-c / 6.1.11 / lib ] indigr [ / usr / local / cellar / mysql-connector-c / 6.1.11 / lib ]

我的 mysql 版本如下:

$mysql -- version mysql Ver 14.14 Distrib 5.7.25,for osx10.14(x8664) using EditLine wrapper

我已经看过几篇与此相关的文章,但还是不能修正。

编辑: 我通过以下两个步骤重新安装了 xcode:

  1. Sudo rm-rf / library / developer / commandlinetools
  2. Xcode-select -- install

现在我在执行 $sudo pip install MySQL-python 时得到了不同的错误

我得到以下错误:

句子太长,请短一点

编辑2: 我看到有人张贴了一个问题,很可能是这个问题的副本。 仅供参考,我采用了这篇文章中建议的方法("pip 安装 MySQL-python"失败,"IndexError"失败)但是我得到了之前的错误。 所以我就贴出来了。

登录后方可回帖

Loading...