不能在Mac Mavericks上安装python mysql库 [英] Can't install python mysql library on Mac Mavericks

查看:127
本文介绍了不能在Mac Mavericks上安装python mysql库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



更新之后,它已损坏,我无法再重新获得环境。



有没有人知道如何解决这个问题?



下面的错误是粗体。

  fedorius @ this:〜$ pip install mysql-python 
下载/解包mysql-python
下载MySQL-python-1.2.5.zip (108kB):108kB下载
运行setup.py(路径:/private/var/folders/21/zjvwzn891jnf4rnp526y13200000gn/T/pip_build_fedorius/mysql-python/setup.py)egg_info for package mysql-python

安装收集的软件包:mysql-python
运行setup.py install for mysql-python
build'_mysql'extension
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DE NABLE_DTRACE -pipe -Dversion_info =(1,2,5,'final',1)-D__version __ = 1.2.5 -I / usr / local / mysql / include -I / System / Library / Frameworks / Python.framework / Versions / 2.7 / include / python2.7 -c _mysql.c -o build / temp.macosx-10.9-intel-2.7 / _mysql.o -Os -g -fno-strict-aliasing -arch x86_64
clang:error:未知参数:'-mno-fused-madd'[-Wunused-command-line-argument-hard-error-in-future]
clang:注意:这将是一个硬错误(不能降级为警告)
错误:命令'cc'失败,退出状态1
完成输出命令/ usr / bin / python -cimport setuptools,tokenize; __ file __''/ private / var / folders /21/zjvwzn891jnf4rnp526y13200000gn/T/pip_build_fedorius/mysql-python/setup.py';exec(compile(getattr(tokenize,'open',open)(__ file __)。read()。replace('\r\\\
' ,'\\\
'),__file__,'exec'))install --record /var/folders/21/zjvwzn891jnf4rnp526y13200000gn/T/pip-_yi6sy-record/install-record.txt --single-v外部管理 - 编译:
运行安装

运行build

运行build_py

创建构建

创建构建/ lib.macosx-10.9-intel-2.7

复制_mysql_exceptions.py - > build / lib.macosx-10.9-intel-2.7

创建build / lib.macosx-10.9-intel-2.7 / MySQLdb

复制MySQLdb / __ init__.py - > build / lib.macosx-10.9-intel-2.7 / MySQLdb

复制MySQLdb / transitions.py - > build / lib.macosx-10.9-intel-2.7 / MySQLdb

复制MySQLdb / connections.py - > build / lib.macosx-10.9-intel-2.7 / MySQLdb

复制MySQLdb / cursors.py - > build / lib.macosx-10.9-intel-2.7 / MySQLdb

复制MySQLdb / release.py - > build / lib.macosx-10.9-intel-2.7 / MySQLdb

复制MySQLdb / times.py - > build / lib.macosx-10.9-intel-2.7 / MySQLdb

创建build / lib.macosx-10.9-intel-2.7 / MySQLdb / constants

复制MySQLdb / __init__.py - > build / lib.macosx-10.9-intel-2.7 / MySQLdb / constants

复制MySQLdb / constants / CR.py - > build / lib.macosx-10.9-intel-2.7 / MySQLdb / constants

复制MySQLdb / constants / FIELD_TYPE.py - > build / lib.macosx-10.9-intel-2.7 / MySQLdb / constants

复制MySQLdb / constants / ER.py - > build / lib.macosx-10.9-intel-2.7 / MySQLdb / constants

复制MySQLdb / constants / FLAG.py - > build / lib.macosx-10.9-intel-2.7 / MySQLdb / constants

复制MySQLdb / constants / REFRESH.py - > build / lib.macosx-10.9-intel-2.7 / MySQLdb / constants

复制MySQLdb / constants / CLIENT.py - > build / lib.macosx-10.9-intel-2.7 / MySQLdb / constants

运行build_ext

构建'_mysql'扩展名

创建构建/临时.macosx-10.9-intel-2.7

cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno- fusion-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info =(1,2,5 ,'final',1)-D__version __ = 1.2.5 -I / usr / local / mysql / include -I / System / Library / Frameworks / Python.framework / Versions / 2.7 / include / python2.7 -c _mysql.c -o build / temp.macosx-10.9-intel-2.7 / _mysql.o -Os -g -fno-strict-aliasing -arch x86_64

** clang:error:unknown参数:'-mno -fused-madd'[-Wunused-command-line-argument-hard-error-in-future]
clang:注意:这将是未来的一个硬错误(不能降级为警告)
错误:命令'cc'失败,退出状态1 **

------ ----------------------------------
清理...
命令/ usr / bin / python -cimport setuptools,tokenize; __ file __ ='/ private / var / folders / 21 / zjvwzn891jnf4rnp526y13200000gn / T / pip_build_fedorius / mysql-python / setup.py'; exec(compile(getattr(tokenize,'open' ,打开)(__ file __)。read()。replace('\r\\\
','\\\
'),__file__,'exec'))install --record / var / folders / 21 / zjvwzn891jnf4rnp526y13200000gn /在/ private / var / folders / 21 / zjvwzn891jnf4rnp526y13200000gn / T / pip_build_fedorius / mysql-python $中的错误代码1的T / pip-_yi6sy-record / install-record.txt - 单独版本 - 外部管理 - b $ b在/ var / folders / 21 / zjvwzn891jnf4rnp526y13200000gn / T / tmp5QBn55中存储调试日志失败

更新:



根据建议,我添加了



export CFLAGS = -Qunused-arguments
导出CPPFLAGS = -Qunused-arguments



但是将错误更改为

 错误:/ Library / Pytho n / 2.7 / site-packages / _mysql.so:权限被拒绝

我只是chmoded这个目录允许写作和它的工作:)
这是由于混合macports,easy_install和pip ...耻辱我。

解决方案

p>问题是由于Xcode 5.1中引入的更改,以及由Apple提供的系统Python 2.7构建的方式。尝试在运行 pip 之前添加这些环境变量值:

  export CFLAGS = -Qunused-arguments 
export CPPFLAGS = -Qunused-arguments

请参阅clang错误:未知参数:'-mno-fused-madd '(python包安装失败)了解更多信息。



更新[2014-05-16]:正如预期的那样,苹果已经将更新的系统在 OS X 10.9.3 中的Pythons(2.7,2.6和2.5),所以在使用最新的小牛和 Xcode 5.1+时,不再需要解决方法。但是,截至目前,如果您使用 Xcode,则 OS X 10.8.x (Mountain Lion,目前为10.8.5)仍然需要解决方法5.1 + 那里。


It was working like a charm before the update from Mountain Lion.

After the update it is broken and I cannot get the environment up again.

Does anybody know how to fix this?

The error is bolded, below.

fedorius@this:~$ pip install mysql-python
Downloading/unpacking mysql-python
  Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded
  Running setup.py (path:/private/var/folders/21/zjvwzn891jnf4rnp526y13200000gn/T/pip_build_fedorius/mysql-python/setup.py) egg_info for package mysql-python

Installing collected packages: mysql-python
  Running setup.py install for mysql-python
    building '_mysql' extension
    cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/mysql/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.9-intel-2.7/_mysql.o -Os -g -fno-strict-aliasing -arch x86_64
    clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
    clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
    error: command 'cc' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/21/zjvwzn891jnf4rnp526y13200000gn/T/pip_build_fedorius/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/21/zjvwzn891jnf4rnp526y13200000gn/T/pip-_yi6sy-record/install-record.txt --single-version-externally-managed --compile:
    running install

running build

running build_py

creating build

creating build/lib.macosx-10.9-intel-2.7

copying _mysql_exceptions.py -> build/lib.macosx-10.9-intel-2.7

creating build/lib.macosx-10.9-intel-2.7/MySQLdb

copying MySQLdb/__init__.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb

copying MySQLdb/converters.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb

copying MySQLdb/connections.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb

copying MySQLdb/cursors.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb

copying MySQLdb/release.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb

copying MySQLdb/times.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb

creating build/lib.macosx-10.9-intel-2.7/MySQLdb/constants

copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb/constants

copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb/constants

copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb/constants

copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb/constants

copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb/constants

copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb/constants

copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb/constants

running build_ext

building '_mysql' extension

creating build/temp.macosx-10.9-intel-2.7

cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/mysql/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.9-intel-2.7/_mysql.o -Os -g -fno-strict-aliasing -arch x86_64

**clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command 'cc' failed with exit status 1**

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/21/zjvwzn891jnf4rnp526y13200000gn/T/pip_build_fedorius/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/21/zjvwzn891jnf4rnp526y13200000gn/T/pip-_yi6sy-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/21/zjvwzn891jnf4rnp526y13200000gn/T/pip_build_fedorius/mysql-python
Storing debug log for failure in /var/folders/21/zjvwzn891jnf4rnp526y13200000gn/T/tmp5QBn55

UPDATE:

As suggested, I've added

export CFLAGS=-Qunused-arguments export CPPFLAGS=-Qunused-arguments

But it changed the error to

error: /Library/Python/2.7/site-packages/_mysql.so: Permission denied

I just chmoded this directory to allow writing and it worked :) This is due to mixing macports, easy_install and pip... shame on me.

解决方案

The problem is due to changes introduced in Xcode 5.1 and due to the way the Apple-supplied system Python 2.7 is built. Try adding these environment variable values before running pip:

export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments

See clang error: unknown argument: '-mno-fused-madd' (python package installation failure) for more information.

UPDATE [2014-05-16]: As expected, Apple has fixed this problem with updated system Pythons (2.7, 2.6, and 2.5) in OS X 10.9.3 so the workaround is no longer necessary when using the latest Mavericks and Xcode 5.1+. However, as of now, the workaround is still required for OS X 10.8.x (Mountain Lion, currently 10.8.5) if you are using Xcode 5.1+ there.

这篇关于不能在Mac Mavericks上安装python mysql库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆