zoukankan      html  css  js  c++  java
  • Mac OS安装Scrapy失败

    报错:

    DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. 
    This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling six-1.4.1:
    Exception:
    Traceback (most recent call last):

    原因分析:

    :Scrapy依赖six库,但是系统的six库比较老,安装scrapy需要卸载之后安装一个新的。但是Mac OS本身也依赖six,导致无法删除,因此没有办法安装Scrapy。

     解决的方式:使用virtualenv来安装。

    1. sudo pip install virtualenv
    2. virtualenv scrapyenv
    3. cd scrapyenv
    4. source bin/activate
    5. pip install Scrapy  

    安装完成之后,安装如下包:

    scapy安装之后的包

    好了,可以使用scrapy startproject yourproject开始你的爬虫之旅了。

    转自:http://blog.csdn.net/tangch0516/article/details/51378664

    执行卸载和重装six的时候 not premitted

    于是:

    xcode-select --install

    sudo pip install scrapy --ignore-installed six

    然后错误:

    ImportError:cannot import name xmlrpc_client
    原因还是因为没有six

    终端下执行

    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

    卸载掉six并重装,再次查看Scrapy版本,搞定。

    如果执行第二条语句出错的话 就说明即便是sudo权限还是被拦截了

    这时候:

    重启电脑 进入 recovery mode (点击command+R) 在左上角的终端中 输入:csrutil disable

    成功!

    Last login: Thu Jan 12 21:39:41 on console

    ChendeMacBook-Pro:~ Chen$ sudo rm -rf /Library/Python/2.7/site-packages/six*

    Password:

    ChendeMacBook-Pro:~ Chen$ sudo rm -rf /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six*

    ChendeMacBook-Pro:~ Chen$ sudo pip install six

    The directory '/Users/apple/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

    The directory '/Users/apple/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

    Requirement already satisfied: six in ./Library/Python/2.7/lib/python/site-packages

    ChendeMacBook-Pro:~ Chen$ python

    Python 2.7.10 (default, Oct 23 2015, 19:19:21) 

    [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin

    Type "help", "copyright", "credits" or "license" for more information.

    >>> import scrapy

    >>> 

  • 相关阅读:
    day67——前后端传输数据的编码格式、ajax传json数据/传文件、批量插入
    day66——choices参数、MTV/MVC模型、三种创建多对多的方式、AJAX
    day65——聚合函数、分组查询、F与Q查询、django开事务、orm查询优化
    dayⅢ、基本数据类型+运算符作业
    dayⅡ:编程语言+变量+垃圾回收制
    dayⅡ:变量作业
    dayⅠ:计算机基础知识
    ⅩⅥ:无参装饰器
    ⅩⅤ:作业
    ⅩⅤ:名称空间与作用域
  • 原文地址:https://www.cnblogs.com/CityPe/p/6279765.html
Copyright © 2011-2022 走看看