【问题标题】:Cant complete mysql-python installation in OSX无法在 OSX 中完成 mysql-python 安装
【发布时间】:2016-09-04 20:59:17
【问题描述】:

我试图让它工作,但我没有成功。我正在尝试通过运行安装mysql-python

pip install mysql-python

但我总是收到此错误

clang: error: invalid version number in '-mmacosx-version-min=10.11'
error: command 'clang' failed with exit status 1

我已经使用自制软件更新了所有库,并且已经安装了 mysql。我还确保拥有最新的 pip、xcode 和 xcode 命令行工具。

我已经搜索了几个小时,但我还没有找到构建这个包的方法。

如果有人遇到过类似情况,我将不胜感激。

Collecting mysql-python
Using cached MySQL-python-1.2.5.zip
Building wheels for collected packages: mysql-python
Running setup.py bdist_wheel for mysql-python ... error
Complete output from command /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/qh/38cj02sj1fb83lfnsd4x3jm40000gn/T/pip-build-lCuswO/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/qh/38cj02sj1fb83lfnsd4x3jm40000gn/T/tmpFVHSn1pip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.11-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.11-x86_64-2.7
creating build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb
creating build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.11-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.11-x86_64-2.7
clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/5.7.12/include/mysql -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.11-x86_64-2.7/_mysql.o -fno-omit-frame-pointer
clang: error: invalid version number in '-mmacosx-version-min=10.11'
error: command 'clang' failed with exit status 1

【问题讨论】:

  • 您使用的 OSX 版本是什么?
  • 埃尔卡皮坦 10.11.4
  • 你能发布完整的回溯吗?
  • 我很想分享它,但我不适合这个评论字段,因为我只能在这里添加大约 600 个字符,关于如何分享这个的任何其他想法
  • 你可以edit the question添加。

标签: python mysql macos pip clang


【解决方案1】:

这可能是因为没有安装 x-code

xcode-select --install

【讨论】:

  • 在安装了 x-code 的情况下使用这个:sudo xcode-select --reset
【解决方案2】:

你应该先通过 Homebrew 安装 MySQL,让 python-mysql 在 OS X 上正常工作。

pip uninstall MySQL-python
brew install mysql
brew install mysql-connector-c
pip install MySQL-python

原答案:MySQL-python on mac

【讨论】:

  • 嘿阿尼!非常感谢您的回复。我已经做了这些,没有运气。仍然给出同样的错误。
  • 我试了修改版,还是不行。我不断收到那个clang错误。不过感谢您的帮助。还有其他想法吗?提前致谢
  • 试过this?还要检查this
  • 我刚刚做了,我得到了完全相同的输出 clang: error: invalid version number in '-mmacosx-version-min=10.11' error: command 'clang' failed with exit status 1
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-11-27
  • 2015-01-13
  • 2012-10-11
  • 1970-01-01
相关资源
最近更新 更多