我收到错误 clang:错误:未知参数:' -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一起
答案 0 :(得分:2)
如果其他人遇到这种情况并且由于某种原因而不愿意通过更改为不同的MySQL安装来解决它,则有一个相对简单的解决方法。我遇到了这个问题,尝试针对Bitnami MAMP堆栈5.5版中包含的MySQL包编译mysqlclient。您只需要调整安装,以便将违规参数传递给编译器,如下所示:
extra_compile_args
变量后(当前版本中的第58-59行),添加以下代码行:extra_compile_args.pop(extra_compile_args.index('-fabi-version=2'))
python setup.py install
为我工作。
答案 1 :(得分:1)
我发现了问题,我安装了XAMPP,而XAMPP的mysql使用了该标志。 我卸载了XAMPP并通过Homebrew安装了mysql,现在一切正常。
答案 2 :(得分:0)
我在使用Softaculous AMPPS时遇到了同样的问题。 根据以上来自Max的回复,我能够弄清楚如何解决该问题。
只需从“ cflags”中删除“ -fabi-version = 2”标志(本例中为122行)