创建 Conda 环境时出现 TypeError
TypeError When Creating Conda Environment
我正在尝试使用以下命令从 yaml 文件创建一个 conda 环境:
conda env create -f myenv.yml python=3
当我的yaml文件是这样写的:
name: myenv
channels:
- conda-forge
dependencies:
- django=1.10.5
- pip:
- gunicorn==19.7.0
- psycopg2==2.6.2
它工作正常。
当我的 yaml 文件是这样写的(没有 conda-forge package/channel):
name: myenv
dependencies:
- pip:
- gunicorn==19.7.0
- psycopg2==2.6.2
它生成以下错误:
Traceback (most recent call last):
File "/home/myuser/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 573, in conda_exception_handler
return_value = func(*args, **kwargs)
File "/home/myuser/anaconda3/lib/python3.6/site-packages/conda_env/cli/main_create.py", line 108, in execute
installer.install(prefix, pkg_specs, args, env)
File "/home/myuser/anaconda3/lib/python3.6/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'
我需要使用没有 conda-forge 包的第二个 yaml 示例。
有什么建议吗?
IMO,这看起来像 conda 中的 bug。但是,您可以通过添加 pip 作为依赖项来解决这个问题。因此,请确保文件 myenv.yml
具有以下内容:
name: myenv
dependencies:
- pip=9.0.1=py27_1
- pip:
- gunicorn==19.7.0
- psycopg2==2.6.2
我正在尝试使用以下命令从 yaml 文件创建一个 conda 环境:
conda env create -f myenv.yml python=3
当我的yaml文件是这样写的:
name: myenv
channels:
- conda-forge
dependencies:
- django=1.10.5
- pip:
- gunicorn==19.7.0
- psycopg2==2.6.2
它工作正常。
当我的 yaml 文件是这样写的(没有 conda-forge package/channel):
name: myenv
dependencies:
- pip:
- gunicorn==19.7.0
- psycopg2==2.6.2
它生成以下错误:
Traceback (most recent call last):
File "/home/myuser/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 573, in conda_exception_handler
return_value = func(*args, **kwargs)
File "/home/myuser/anaconda3/lib/python3.6/site-packages/conda_env/cli/main_create.py", line 108, in execute
installer.install(prefix, pkg_specs, args, env)
File "/home/myuser/anaconda3/lib/python3.6/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'
我需要使用没有 conda-forge 包的第二个 yaml 示例。
有什么建议吗?
IMO,这看起来像 conda 中的 bug。但是,您可以通过添加 pip 作为依赖项来解决这个问题。因此,请确保文件 myenv.yml
具有以下内容:
name: myenv
dependencies:
- pip=9.0.1=py27_1
- pip:
- gunicorn==19.7.0
- psycopg2==2.6.2