问题
I'm trying to install scrapy on mac os 10.9.1
sudo pip install scrapy
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -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 -arch x86_64 -arch i386 -pipe -I/usr/include/libxml2 -I/private/var/folders/k6/g5dx4fj91tdf6f4_28p6fh980000gn/T/pip_build_tommy/lxml/src/lxml/includes -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.9-intel-2.7/src/lxml/lxml.etree.o -w -flat_namespace
xcrun: error: active developer path ("/Developer") does not exist, use xcode-select to change
error: command 'cc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/k6/g5dx4fj91tdf6f4_28p6fh980000gn/T/pip_build_tommy/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/k6/g5dx4fj91tdf6f4_28p6fh980000gn/T/pip-BlN0gM-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/k6/g5dx4fj91tdf6f4_28p6fh980000gn/T/pip_build_tommy/lxml
Storing debug log for failure in /Users/tommy/Library/Logs/pip.log
I also tried pip install scrapy without sudo, also failed with the same error.
I checked the similar issue on S.O, and found this
I followed the solution there
ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11 /usr/local/include/X11
No such file or directory.
I'm new to Mac os. could you give some suggestions? or another convenient way to install scrapy?
I used anaconda before, but it doesn't have scrapy incorporated. And I heard there's a package manager called homebrew..but I have no idea how to use it.
Thanks a lot!
回答1:
Did you see the update to the answer you linked?
Try this in your terminal:
xcode-select --install
回答2:
I tried to update my Xcode, and installed the xcode command line. then installed homebrew, reinstalled the python, and pip install scrapy. It turns out totally OK.
So if you have such problems, and you don't have much knowledge about mac, try to follow the steps: check the version of your Xcode, and using homebrew to get pip, and then it would be OK.
来源:https://stackoverflow.com/questions/22063105/installation-scrapy-error-on-mac-10-9-1-using-pip