最近在anaconda创建虚拟环境的时候,发现创建失败了,然后我就想删除原来创建失败的虚拟环境,发现删不掉,错误日志:

WARNING: A directory already exists at the target location '/home/suser/anaconda3/envs/py39'
but it is not a conda environment.
Continue creating environment (y/[n])? y


CondaValueError: prefix already exists: /home/suser/anaconda3/envs/py39

解决方法

直接手动删除后,重新创建.

rm -rf /home/suser/anaconda3/envs/py39
conda clean --all
conda create -n py39 python=3.9

参考文献

解决conda安装时出现的CondaVerificationError问题