pip安装依赖于six的库错误解决方案

前言

在安装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

你可能感兴趣的:(python)