pipインストールsix依存ライブラリエラーソリューション

5753 ワード

前言scrapy爬虫庫装着時の異常
Found existing installation: six 1.4.1
    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.

#   :1.4.1
       :     distutils   ( )    ,          。       distutils          。

たぶん原因は
This is because OS X El Capitan ships with six 1.4.1 installed already and when it attempts to uninstall it (because awscli depends on botocore, botocore depends on python-dateutil, and python-dateutil depends on six >= 1.5) it doesn't have permission to do so because System Integrity Protection doesn't allow even root to modify those directories.

Ideally, pip should just skip uninstalling those items since they aren't installed to site-packages they are installed to a special Apple directory. However, even if pip skips uninstalling those items and installs six into site-packages we'll hit another bug where Apple puts their pre-installed stuff earlier in the sys.path than site-packages. I've talked to Apple about this and I'm not sure if they're going to do anything about it or not.

#   
    OS X El Capitan          1.4.1,        (  awscli   botocore,botocore   python-dateutil,python-dateutil    > = 1.5)               root      。

     ,           ,                           。   ,  pip                   ,           ,             sys.path        。             ,              。

ソリューション
sudo pip install six --upgrade --ignore-installed six

#     ,          
Collecting six
  Downloading six-1.11.0-py2.py3-none-any.whl
Installing collected packages: six
Successfully installed six-1.11.0

#    scrapy
sudo pip install scrapy

#     ,          
Successfully installed Automat-0.6.0 PyDispatcher-2.0.5 Twisted-17.9.0 attrs-17.3.0 constantly-15.1.0 cssselect-1.0.1 hyperlink-17.3.1 incremental-17.5.0 parsel-1.2.0 pyasn1-0.4.2 pyasn1-modules-0.2.1 queuelib-1.4.2 scrapy-1.4.0 service-identity-17.0.0 w3lib-1.18.0

#          scrapy
pip list

参照先:https://github.com/pypa/pip/issues/3165