Python模块Scrapy导入出错:ImportError: cannot import name xmlrpc_client

Mac(OS version: OS X Yosemite 10.10.5)上安装Scrapy模块,使用时出现:

from six.moves import xmlrpc_client as xmlrpclib


ImportError: cannot import name xmlrpc_client


错误


解决方法:


sudo rm -rf /Library/Python/2.7/site-packages/six

sudo rm -rf /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six


sudo pip install six

遇到错误需要关闭mac sip

If you encounter an error rm: /System/Library/... Operation not permitted


Please try to disable System Integrity Protection

See Operation Not Permitted when on root El capitan (rootless disabled)


关闭Mac sip的方法是

https://www.52mac.com/soft/9464-1-1.html