gpt4 book ai didi

python - pip 和 conda environment.yml : unsupported operand type(s) for +: 'NoneType' and 'list'

转载 作者:行者123 更新时间:2023-11-28 17:13:01 26 4
gpt4 key购买 nike

我正在尝试在 conda 环境中安装一个带有 pip 的包。所以我有一个 environment.yml 文件如下:

name: test-env

dependencies:
- pip:
- "git+https://github.com/choldgraf/download"

但是当我运行 conda env update --file environment.yml 时,我得到:

Using Anaconda API: https://api.anaconda.org
Fetching package metadata .............
Solving package specifications: An unexpected error has occurred.
Please consider posting the following information to the
conda GitHub issue tracker at:

# Here some configuration that I omit

Traceback (most recent call last):
File "/home/mathurin/anaconda3/lib/python3.5/site-packages/conda/exceptions.py", line 634, in conda_exception_handler
return_value = func(*args, **kwargs)
File "/home/mathurin/anaconda3/lib/python3.5/site-packages/conda_env/cli/main_update.py", line 106, in execute
installer.install(prefix, specs, args, env, prune=args.prune)
File "/home/mathurin/anaconda3/lib/python3.5/site-packages/conda_env/installers/pip.py", line 8, in install
pip_cmd = pip_args(prefix) + ['install', ] + specs
TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'

但是,只需在我的 bash 控制台中输入 pip install git+https://github.com/choldgraf/download 就可以正常工作。我做错了什么?

编辑:我的第一个想法是更新 conda。我现在的版本是 4.3.23,并尝试 conda update conda 产量:

# All requested packages already installed.
# packages in environment at ~/anaconda3:
#
conda 4.3.23 py35_0 conda-forge

最佳答案

我遇到了同样的问题。我找到了解决方案。您必须向您的配置添加至少一个依赖项(我不确定它是否必须是 pip)。在我的配置中,我添加了 pip=9.0.1=py35_1

name: myenv
channels:
- defaults
dependencies:
- pip=9.0.1=py35_1
- pip:
- tqdm==4.19.5

所以我认为你的情况应该是这样的:

name: test-env
dependencies:
- pip=9.0.1=py35_1
- pip:
- "git+https://github.com/choldgraf/download"

关于python - pip 和 conda environment.yml : unsupported operand type(s) for +: 'NoneType' and 'list' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46179956/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com