Mac OSX でPythonのScrapyをインストールする時に躓いた事
こちらにある,Scrapyのインストールガイドを参考にして素直にpip installを実行したらハマった.
Installation guide — Scrapy 1.0.3 documentation
MacBook-Pro-9:$ pip install scrapy
Collecting scrapy Downloading Scrapy-1.0.3.tar.gz (948kB) 100% |████████████████████████████████| 950kB 296kB/s Collecting Twisted>=10.0.0 (from scrapy) Downloading Twisted-15.4.0.tar.bz2 (3.1MB) 100% |████████████████████████████████| 3.1MB 108kB/s Collecting w3lib>=1.8.0 (from scrapy) Downloading w3lib-1.12.0-py2.py3-none-any.whl Collecting queuelib (from scrapy) Downloading queuelib-1.4.2-py2.py3-none-any.whl Collecting lxml (from scrapy) Downloading lxml-3.4.4.tar.gz (3.5MB) 100% |████████████████████████████████| 3.5MB 109kB/s Collecting pyOpenSSL (from scrapy) Downloading pyOpenSSL-0.15.1-py2.py3-none-any.whl (102kB) 100% |████████████████████████████████| 106kB 108kB/s Collecting cssselect>=0.9 (from scrapy) Downloading cssselect-0.9.1.tar.gz Requirement already satisfied (use --upgrade to upgrade): six>=1.5.2 in /usr/local/lib/python3.4/site-packages (from scrapy) Collecting service-identity (from scrapy) Downloading service_identity-14.0.0-py2.py3-none-any.whl Collecting zope.interface>=4.0.2 (from Twisted>=10.0.0->scrapy) Downloading zope.interface-4.1.3.tar.gz (141kB) 100% |████████████████████████████████| 143kB 648kB/s Collecting cryptography>=0.7 (from pyOpenSSL->scrapy) Downloading cryptography-1.0.2.tar.gz (332kB) 100% |████████████████████████████████| 335kB 521kB/s Collecting characteristic>=14.0.0 (from service-identity->scrapy) Downloading characteristic-14.3.0-py2.py3-none-any.whl Collecting pyasn1 (from service-identity->scrapy) Downloading pyasn1-0.1.9-py2.py3-none-any.whl Collecting pyasn1-modules (from service-identity->scrapy) Downloading pyasn1_modules-0.0.8-py2.py3-none-any.whl Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/local/lib/python3.4/site-packages/setuptools-15.2-py3.4.egg (from zope.interface>=4.0.2->Twisted>=10.0.0->scrapy) Collecting idna>=2.0 (from cryptography>=0.7->pyOpenSSL->scrapy) Downloading idna-2.0-py2.py3-none-any.whl (61kB) 100% |████████████████████████████████| 61kB 634kB/s Collecting cffi>=1.1.0 (from cryptography>=0.7->pyOpenSSL->scrapy) Downloading cffi-1.2.1.tar.gz (335kB) 100% |████████████████████████████████| 335kB 289kB/s Complete output from command python setup.py egg_info: cc1: error: unrecognized command line option "-Wno-unused-result" cc1: error: unrecognized command line option "-Wno-unused-result" No working compiler found, or bogus compiler options passed to the compiler from Python's distutils module. See the error messages above. (If they are about -mno-fused-madd and you are on OS/X 10.8, see http://stackoverflow.com/questions/22313407/ .) ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/pw/y9z4j4y133v6sf6b8_z906km0000gn/T/pip-build-djas2rha/cffi
どうやらcffiをdownloadした直後に死んでいる.
はじめは,
cc1: error: unrecognized command line option "-Wno-unused-result"
この手のエラーが出ていたのでgccの問題かな?と思いgccのバージョンを確認していた.
MacBook-Pro-9:$ gcc -v Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) Target: x86_64-apple-darwin13.3.0 Thread model: posix
う〜んLLVMの問題かな…と悩んでいたが同様のエラーは見つからなかった.
再びインストールガイドを確認したところ,pythonの推奨系列は2系列だったことを確認.
MacBook-Pro-9:$ pip --version pip 7.1.2 from /usr/local/lib/python3.4/site-packages (python 3.4)
どうやらデフォルトが3系列になっていたらしい…
これを
MacBook-Pro-9:$ pip2.7 install scrapy
と明示的に2系列を使用するとしたうえでインストールを行うと無事にインストールできた.
Collecting scrapy Downloading Scrapy-1.0.3-py2-none-any.whl (290kB) 100% |████████████████████████████████| 294kB 639kB/s Collecting cssselect>=0.9 (from scrapy) Using cached cssselect-0.9.1.tar.gz Collecting queuelib (from scrapy) Using cached queuelib-1.4.2-py2.py3-none-any.whl Collecting pyOpenSSL (from scrapy) Using cached pyOpenSSL-0.15.1-py2.py3-none-any.whl Collecting w3lib>=1.8.0 (from scrapy) Using cached w3lib-1.12.0-py2.py3-none-any.whl Collecting lxml (from scrapy) Using cached lxml-3.4.4.tar.gz Collecting Twisted>=10.0.0 (from scrapy) Using cached Twisted-15.4.0.tar.bz2 Requirement already satisfied (use --upgrade to upgrade): six>=1.5.2 in /usr/local/lib/python2.7/site-packages (from scrapy) Collecting service-identity (from scrapy) Using cached service_identity-14.0.0-py2.py3-none-any.whl Collecting cryptography>=0.7 (from pyOpenSSL->scrapy) Using cached cryptography-1.0.2.tar.gz Collecting zope.interface>=3.6.0 (from Twisted>=10.0.0->scrapy) Using cached zope.interface-4.1.3.tar.gz Collecting characteristic>=14.0.0 (from service-identity->scrapy) Using cached characteristic-14.3.0-py2.py3-none-any.whl Collecting pyasn1-modules (from service-identity->scrapy) Using cached pyasn1_modules-0.0.8-py2.py3-none-any.whl Collecting pyasn1 (from service-identity->scrapy) Using cached pyasn1-0.1.9-py2.py3-none-any.whl Collecting idna>=2.0 (from cryptography>=0.7->pyOpenSSL->scrapy) Using cached idna-2.0-py2.py3-none-any.whl Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/local/lib/python2.7/site-packages/setuptools-15.2-py2.7.egg (from cryptography>=0.7->pyOpenSSL->scrapy) Collecting enum34 (from cryptography>=0.7->pyOpenSSL->scrapy) Downloading enum34-1.0.4.tar.gz Collecting ipaddress (from cryptography>=0.7->pyOpenSSL->scrapy) Downloading ipaddress-1.0.14-py27-none-any.whl Collecting cffi>=1.1.0 (from cryptography>=0.7->pyOpenSSL->scrapy) Using cached cffi-1.2.1.tar.gz Collecting pycparser (from cffi>=1.1.0->cryptography>=0.7->pyOpenSSL->scrapy) Downloading pycparser-2.14.tar.gz (223kB) 100% |████████████████████████████████| 225kB 145kB/s Installing collected packages: cssselect, queuelib, idna, pyasn1, enum34, ipaddress, pycparser, cffi, cryptography, pyOpenSSL, w3lib, lxml, zope.interface, Twisted, characteristic, pyasn1-modules, service-identity, scrapy Running setup.py install for cssselect Running setup.py install for enum34 Running setup.py install for pycparser Running setup.py install for cffi Running setup.py install for cryptography Running setup.py install for lxml Running setup.py install for zope.interface Running setup.py install for Twisted Successfully installed Twisted-15.4.0 cffi-1.2.1 characteristic-14.3.0 cryptography-1.0.2 cssselect-0.9.1 enum34-1.0.4 idna-2.0 ipaddress-1.0.14 lxml-3.4.4 pyOpenSSL-0.15.1 pyasn1-0.1.9 pyasn1-modules-0.0.8 pycparser-2.14 queuelib-1.4.2 scrapy-1.0.3 service-identity-14.0.0 w3lib-1.12.0 zope.interface-4.1.3
みなさまも推奨バージョンにはご注意を…