基于Conda完成创建多版本python环境

2023-10-16 17:33:43 浏览数 (1)

基于Conda完成创建多版本python环境

  1. 通过cmd打开conda环境
代码语言:javascript复制
d:ProgramDataAnaconda3Scriptsactivate
  1. 创建python3.7的环境
代码语言:javascript复制
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 use conda config --show-sources to view config file locations.

  1. 解决UnavailableInvalidChannel错误 按照提示输出channels和sources
代码语言:javascript复制
(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
  1. 重新创建python3.7环境
代码语言:javascript复制
conda create -n py3.7 python=3.7.0
  1. 激活python3.7的环境
代码语言:javascript复制
conda activate py3.7
  1. 查看存在的python版本
代码语言:javascript复制
conda env list

0 人点赞