基于Conda完成创建多版本python环境
- 通过cmd打开conda环境
代码语言:javascript
复制
d:\ProgramData\Anaconda3\Scripts\activate
- 创建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 useconda config --show-sources
to view config file locations.
- 解决UnavailableInvalidChannel错误 按照提示输出channels和sources
代码语言:javascript
复制
(base) E:\vscode\zhaopin>conda config --show channels
channels:
- http://mirrors.aliyun.com/pypi/simple/
(base) E:\vscode\zhaopin>conda config --show-sources
==> C:\Users\DELL.condarc <==
ssl_verify: True
channels:
http://mirrors.aliyun.com/pypi/simple/
show_channel_urls: True
移除指定的案例镜像
代码语言:javascript
复制
(base) E:\vscode\zhaopin>conda config --remove-key channels
(base) E:\vscode\zhaopin>conda config --show-sources
==> C:\Users\DELL.condarc <==
ssl_verify: True
show_channel_urls: True
(base) E:\vscode\zhaopin>conda config --show channels
channels:
defaults
- 重新创建python3.7环境
代码语言:javascript
复制
conda create -n py3.7 python=3.7.0
- 激活python3.7的环境
代码语言:javascript
复制
conda activate py3.7
- 查看存在的python版本
代码语言:javascript
复制
conda env list