无法导入python-goose(OSX 10.9)
我正在尝试在虚拟环境中正确设置python-goose。
更新:我把python删掉了,按照这里的步骤重新安装了一遍。
我按照python-goose的说明做了以下操作:
mkvirtualenv --no-site-packages goose
git clone https://github.com/grangier/python-goose.git
cd python-goose
pip install -r requirements.txt
python setup.py install
pip install -r requirements.txt
在安装lxml
时失败了。
现在我收到的错误是:
error: command 'cc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /Users/me/.virtualenvs/goose/bin/python -c "import setuptools, tokenize;__file__='/Users/me/.virtualenvs/goose/build/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/wg/82j6ndq50tl4m9rjkqszyx8r0000gp/T/pip-c9DtYT-record/install-record.txt --single-version-externally-managed --compile --install-headers
/Users/me/.virtualenvs/goose/include/site/python2.7 failed with error code 1 in
/Users/me/.virtualenvs/goose/build/lxml
我是不是做错了什么,或者有没有其他方法可以尝试让它正常工作?
1 个回答
1
最后找到了解决办法:
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
这个错误似乎是因为苹果在Xcode 5.1中更新了最新的clang造成的。
“更新:没想到这个问题会引起这么多关注,不过我再多说一点:苹果提供的clang 3.4默认会对未知的标志报错,而CPython在构建模块时使用的是它最初编译时的同一组标志。系统中的CPython是用一些clang不知道的标志编译的,所以就出现了这个问题。”
想了解更多,可以点击这里: https://stackoverflow.com/a/22315129/2673189
再次感谢Wolph和pseudocubic,你们帮了大忙。