基于Conda完成创建多版本python环境
- 通过cmd打开conda环境
d:ProgramDataAnaconda3Scriptsactivate
- 创建python3.7的环境
conda create -n py3.7 python=3.7
产生错误
Collecting package metadata (repodata.json): failed UnavailableInvalidChannel: The channel is not accessible or is invalid. channel name: pypi/simple channel url: http://mirrors.aliyun.com/pypi/simple error code: 404 You will need to adjust your conda configuration to proceed. Use
conda config --show channels
to view your configuration’s current state, and useconda config --show-sources
to view config file locations.
- 解决UnavailableInvalidChannel错误 按照提示输出channels和sources
(base) E:vscodezhaopin>conda config --show channels
channels:
- http://mirrors.aliyun.com/pypi/simple/
(base) E:vscodezhaopin>conda config --show-sources
==> C:UsersDELL.condarc <==
ssl_verify: True
channels:
- http://mirrors.aliyun.com/pypi/simple/
show_channel_urls: True
移除指定的案例镜像
代码语言:javascript复制(base) E:vscodezhaopin>conda config --remove-key channels
(base) E:vscodezhaopin>conda config --show-sources
==> C:UsersDELL.condarc <==
ssl_verify: True
show_channel_urls: True
(base) E:vscodezhaopin>conda config --show channels
channels:
- defaults
- 重新创建python3.7环境
conda create -n py3.7 python=3.7.0
- 激活python3.7的环境
conda activate py3.7
- 查看存在的python版本
conda env list