AttributeError: 'NoneType' 对象没有属性 'excluded_of' [英] AttributeError: 'NoneType' object has no attribute 'excluded_of'
问题描述
通过 pip 安装依赖项时出现属性错误
I am getting attribute error while installing the dependencies via pip
Traceback (most recent call last):
File "/home/jpg/.virtual_env/cloud/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 210, in _main
status = self.run(options, args)
File "/home/jpg/.virtual_env/cloud/lib/python3.6/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
return func(self, options, args)
File "/home/jpg/.virtual_env/cloud/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 319, in run
reqs, check_supported_wheels=not options.target_dir
File "/home/jpg/.virtual_env/cloud/lib/python3.6/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 122, in resolve
requirements, max_rounds=try_to_avoid_resolution_too_deep,
File "/home/jpg/.virtual_env/cloud/lib/python3.6/site-packages/pip/_vendor/resolvelib/resolvers.py", line 445, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "/home/jpg/.virtual_env/cloud/lib/python3.6/site-packages/pip/_vendor/resolvelib/resolvers.py", line 344, in resolve
success = self._backtrack()
File "/home/jpg/.virtual_env/cloud/lib/python3.6/site-packages/pip/_vendor/resolvelib/resolvers.py", line 287, in _backtrack
criterion = self.state.criteria[name].excluded_of([candidate])
AttributeError: 'NoneType' object has no attribute 'excluded_of'
我的 requirements.txt
看起来像
celery==5.0.2
billiard<4.0,>=3.6.0
redis==3.5.3
redis-log-handler==0.0.1.dev32
推荐答案
Update - 1 (on 2020-12-27)
该问题已在 pip==20.3.3
中修复,因此您不会收到此异常.
Update - 1 (on 2020-12-27)
The issue has been fixed in pip==20.3.3
and thus you will not receive this exception.
但是,(这里)redis-log-handler==0.0.1.dev32
依赖于 redis==3.0.1
但是,你有 redis==3.5.3
在 requirements.txt 上,因此依赖项将无法解析.所以,你会进一步收到一个错误(我会说,一个验证错误),
But, (here) the redis-log-handler==0.0.1.dev32
depends on redis==3.0.1
but, you have redis==3.5.3
on the requirements.txt and hence the dependencies will not resolve. So, you will further receive and an error (I would say, a validation error) as,
错误:无法安装 -r requirements.txt(第 4 行)和 redis==3.5.3因为这些包版本存在相互冲突的依赖关系.
ERROR: Cannot install -r requirements.txt (line 4) and redis==3.5.3 because these package versions have conflicting dependencies.
冲突是由以下原因引起的:用户请求 redis==3.5.3redis-log-handler 0.0.1.dev32 依赖于 redis==3.0.1
The conflict is caused by: The user requested redis==3.5.3 redis-log-handler 0.0.1.dev32 depends on redis==3.0.1
要解决此问题,您可以尝试:
To fix this you could try to:
- 放宽您指定的软件包版本范围
- 删除包版本以允许 pip 尝试解决依赖冲突
这个错误报告非常有用,是时候调整你的包依赖了.
This error report is pretty much helpful and it is time to adjust your package dependencies.
注意: 如果您对调整依赖项不感兴趣并想像以前一样解决它,请阅读以下部分
这是 pip 版本 20.3
的问题并且尚未修复已在pip==20.3.3
中修复.
This is an issue with pip version 20.3
and not yet fixed fixed in pip==20.3.3
.
安装以前稳定版本的 pip (20.2.X),
Install the previous stable version of the pip (20.2.X) by,
pip install --upgrade pip~=20.2.0
方法二
在安装要求
pip install -r requirements.txt --use-deprecated=legacy-resolver
这篇关于AttributeError: 'NoneType' 对象没有属性 'excluded_of'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!