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

在尝试安装Python爬虫库时遇到了依赖six的库安装异常。问题源于pip安装过程中的冲突。参照GitHub上的issue #3165,提供了具体的解决方案。
部署运行你感兴趣的模型镜像

前言

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

您可能感兴趣的与本文相关的镜像

Python3.10

Python3.10

Conda
Python

Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值