gpt4 book ai didi

python - 尝试在 Mac OS X Yosemite 上安装 MySQL-python 时出错

转载 作者:行者123 更新时间:2023-11-29 05:16:39 33 4
gpt4 key购买 nike

我收到一个错误 clang: error: unknown argument: '-fabi-version=2'当我尝试使用 pip 安装 mysql-python 时。

MacBook-Pro-de-Haruan:MySQL-python-1.2.5 haruan$ sudo -E pip install MySQL-python
The directory '/Users/haruan/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/haruan/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting MySQL-python
Downloading MySQL-python-1.2.5.zip (108kB)
100% |████████████████████████████████| 110kB 311kB/s
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python
Complete output from command /usr/local/opt/python/bin/python2.7 -c "import setuptools, tokenize;__file__='/private/var/folders/sh/gl953xl12p3fl1k0lkw10_k00000gn/T/pip-build-ZBmISy/MySQL-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/sh/gl953xl12p3fl1k0lkw10_k00000gn/T/pip-5RkJ0a-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.10-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.10-x86_64-2.7
creating build/lib.macosx-10.10-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb
creating build/lib.macosx-10.10-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.10-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.10-x86_64-2.7
clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/Applications/XAMPP/xamppfiles/include -I/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.10-x86_64-2.7/_mysql.o -arch x86_64 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing
clang: error: unknown argument: '-fabi-version=2'
error: command 'clang' failed with exit status 1

----------------------------------------
Command "/usr/local/opt/python/bin/python2.7 -c "import setuptools, tokenize;__file__='/private/var/folders/sh/gl953xl12p3fl1k0lkw10_k00000gn/T/pip-build-ZBmISy/MySQL-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/sh/gl953xl12p3fl1k0lkw10_k00000gn/T/pip-5RkJ0a-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/sh/gl953xl12p3fl1k0lkw10_k00000gn/T/pip-build-ZBmISy/MySQL-python

我已经用过:

export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
export ARCHFLAGS='-Wno-error=unused-command-line-argument-hard-error-in-future'

sudo -E ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future easy_install mysql-python

sudo -E ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip mysql-python

问题仍然存在。

我的 Xcode 是版本 6.4 (6E35b)我正在使用 Mac OS X Yosemite

最佳答案

如果其他人遇到此问题并且出于某种原因不想通过更改为不同的 MySQL 安装来解决它,则有一个相对简单的解决方法。我在尝试针对 Bitnami MAMP 堆栈 5.5 版中包含的 MySQL 包编译 mysqlclient 时遇到了这个问题。您只需要调整安装,这样有问题的参数就不会传递给编译器,如下所示:

  1. GitHub下载包
  2. 打开 setup_posix.py 文件
  3. extra_compile_args 变量初始化后(当前版本第 58-59 行),添加以下代码行:extra_compile_args.pop(extra_compile_args.index('-fabi-version =2'))
  4. 在包目录下,运行python setup.py install

为我工作。

关于python - 尝试在 Mac OS X Yosemite 上安装 MySQL-python 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31865818/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com