首页 文章

pip和conda environment.yml:不支持的操作数类型:'NoneType'和'list'

提问于
浏览
2

我正在尝试在conda env中安装带有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

1 回答

  • 0

    我有同样的问题 . 我've found a solution. You have to add at least one dependency to your configuration (I'我不确定它是否必须是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"
    

相关问题