Using a pip requirements file in a conda yml file throws AttributeError: #39;FileNotFoundError#39;(在Conda YML文件中使用pip要求文件会引发AttributeError:#39;FileNotFoundError#39;)
问题描述
我有一个requirements.txt
赞
numpy
和包含
的environment.yml
# run via: conda env create --file environment.yml
---
name: test
dependencies:
- python>=3
- pip
- pip:
- -r file:requirements.txt
当我随后运行conda env create --file environment.yml
时,我收到
Pip子进程输出:
Pip子进程错误: 错误:异常:
<;.PIP>;中的错误回溯
AttributeError:"FileNotFoundError"对象没有属性""Read""
失败
CondaEnvException:PIP失败
调用pip的方式也很奇怪,就像错误发生前报告的那样:
['$HOME/.conda/envs/test/bin/python', '-m', 'pip', 'install', '-U', '-r', '$HOME/test/condaenv.8d3003nm.requirements.txt']
(我将我的主路径替换为$HOME
)
注意requirements.txt
的奇怪扩展。
有什么想法吗?
推荐答案
21.2.1中对管道行为的更改
A recent change in the Pip code已将其行为更改为在file:
URI语法方面更加严格。As pointed out由Pypa成员和Pip开发人员根据the RFC8089 specification,语法file:requirements.txt
不是有效的URI。
相反,必须完全放弃file:
方案:
name: test
dependencies:
- python>=3
- pip
- pip:
- -r requirements.txt
或提供有效的URI,即使用绝对路径(或本地文件服务器):
name: test
dependencies:
- python>=3
- pip
- pip:
- -r file:/full/path/to/requirements.txt
# - -r file:///full/path/to/requirements.txt # alternate syntax
这篇关于在Conda YML文件中使用pip要求文件会引发AttributeError:';FileNotFoundError';的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在Conda YML文件中使用pip要求文件会引发AttributeError:';FileNotFoundError';


基础教程推荐
- Kivy 使用 opencv.调整图像大小 2022-01-01
- Python 中是否有任何支持将长字符串转储为块文字或折叠块的 yaml 库? 2022-01-01
- 比较两个文本文件以找出差异并将它们输出到新的文本文件 2022-01-01
- 在 Python 中将货币解析为数字 2022-01-01
- 在 Django Admin 中使用内联 OneToOneField 2022-01-01
- Python,确定字符串是否应转换为 Int 或 Float 2022-01-01
- matplotlib 设置 yaxis 标签大小 2022-01-01
- kivy 应用程序中的一个简单网页作为小部件 2022-01-01
- 对多索引数据帧的列进行排序 2022-01-01
- 究竟什么是“容器"?在蟒蛇?(以及所有的 python 容器类型是什么?) 2022-01-01