ResolvePackageNotFound: Create env using conda and yml file on MacOS

后端 未结 6 1285
逝去的感伤
逝去的感伤 2020-12-15 04:02

I want to create a virtual environment using conda and yml file.

Command:

conda env create -n ex3 -f env.yml

Type ENTER it gives fo

6条回答
  •  情话喂你
    2020-12-15 04:41

    If you are looking at this and feel too much chore to change Conda version packge=ver=py.* to pip style package==ver, I wrote this small script that delete the =py.* part from Conda style.

    Note below code work on the presume that you already changed package=ver to package==ver.

    #!/bin/bash
    
    COUNT=0
    find_pip=0
    
    while IFS= read -r line; do
        COUNT=$(( $COUNT + 1 ))
    #    echo "$COUNT"
    #    echo "read it"
        if echo ${line} | grep -q -- "- pip:" ; then
    #        echo "find it"
            find_pip=1
            indent=`awk -F- '{print length($1)}' <<< "$line"`
            pip_indent=$(( $indent + 2 ))
    #        echo $indent
    #    echo $pip_indent
        fi
    
        line_indent=`awk -F- '{print length($1)}' <<< "$line"`
    
        if [[ ${find_pip} ]] && [[ ${pip_indent} -eq ${line_indent} ]]; then
    #        echo "$line"
            new_line=`echo ${line} | cut -d'=' -f-3`
            new_line="    $new_line"
    #        echo "${new_line}"
            sed -e "${COUNT}s/.*/${new_line}/" -i '' $1
        fi
    done < "$1"
    

提交回复
热议问题