问题描述
conda创建新环境时报错:
Solving environment: failed
CondaValueError: Malformed version string ‘~’: invalid character(s).
(py3) C:\Users\niede>conda create -n narre python=3.7
Solving environment: failed
CondaValueError: Malformed version string '~': invalid character(s).
原因分析:
.condarc文件有问题,之前做研究调整过很多次镜像源,包括http\https等问题,调整越多问题越多。
解决方案:
提供一种可用的.condarc文件供参考(文件位置:C:\Users\your_name)。
channels:
- defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
运行结果正常如下:
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.5.11
latest version: 24.7.1
Please update conda by running
$ conda update -n base -c defaults conda
## Package Plan ##
environment location: D:\anaconda\envs\narre
added / updated specs:
- python=3.7