我有一个requirements.txt喜欢
numpy
Run Code Online (Sandbox Code Playgroud)
和一个environment.yml包含
numpy
Run Code Online (Sandbox Code Playgroud)
当我然后跑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']
Run Code Online (Sandbox Code Playgroud)
(我用 替换了我的主路径$HOME)注意requirements.txt.
有任何想法吗?
mer*_*erv 10
Pip 代码的最新更改已将其行为更改为在file:URI 语法方面更加严格。正如PyPA 成员和 Pip 开发人员所指出的,file:requirements.txt根据RFC8089 规范,语法不是有效的 URI 。
相反,必须file:完全删除模式:
name: test
dependencies:
- python>=3
- pip
- pip:
- -r requirements.txt
Run Code Online (Sandbox Code Playgroud)
或提供有效的 URI,这意味着使用绝对路径(或本地文件服务器):
name: test
dependencies:
- python>=3
- pip
- pip:
- -r file:/full/path/to/requirements.txt
# - -r file:///full/path/to/requirements.txt # alternate syntax
Run Code Online (Sandbox Code Playgroud)