首页 > 代码库 > mac下安装scrapy的各种艰辛
mac下安装scrapy的各种艰辛
1.没有pip工具包,安装 :终端下 ,wget https://bootstrap.pypa.io/get-pip.py
安装pip:sudo python get-pip.py
2.修改pip源码地址(国外地址太慢)
Mac配置 .pip/pip.conf
mkdir .pip
touch pip.conf
vim 打开pip.conf
填写:
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com
保存pip.conf
3. xcode-select -install
sudo pip install Scrapy
安装过程中出现:imortError: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
如果出现权限问题:可能是OS X 的机制tootless问题
重启电脑:command+r ,进入 选择recovery mode ,左上角 选择终端 运行 csrutil disable 命令 重启电脑
安装完查看scrapy版本是出现:
Traceback (most recent call last):
File "/usr/local/bin/Scrapy", line 7, in <module>
from scrapy.cmdline import execute
File "/Library/Python/2.7/site-packages/scrapy/__init__.py", line 27, in <module>
from . import _monkeypatches
File "/Library/Python/2.7/site-packages/scrapy/_monkeypatches.py", line 2, in <module>
from six.moves import copyreg
ImportError: No module named six.moves
初次以为是six没安装成功就重新安装了six ,最新版本1.10.0
scrapy查看版本还是出现此错误
sudo -H pip install scrapy
查看正常
mac下安装scrapy的各种艰辛