首页 > 编程语言 >通过安装anaconda来管理python版本

通过安装anaconda来管理python版本

时间:2023-01-17 19:45:05浏览次数:64  
标签:版本 python anaconda conda tsinghua https edu cn

通过安装anaconda来管理python版本

1.准备下载

 anaconda 官网下载地址:https://www.anaconda.com/products/distribution#Downloads

注意安装时不要选择添加到path,后期自己手动添加

D:\Software\Anaconda3;
D:\Software\Anaconda3\Scripts;
D:\Software\Anaconda3\Library\mingw-w64\bin;
D:\Software\Anaconda3\Library\usr\bin;
D:\Software\Anaconda3\Library\bin;

2.更换anaconda镜像源:

打开Anacoda Prompt输入命令:

        conda config --set show_channel_urls yes

        conda config --set always_yes True

接着用文本编辑器打开"C:\Users\xxx.condarc"文件,将内容换为下面的内容(下面使用的是清华镜像)

channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - 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

清除缓存: conda clean -i

3.conda常用命令使用

 1.创建虚拟环境(多个python版本管理切换,python软件包版本管理切换)
 conda create -n py27env python=2.7
 conda create -n py36env python=3.6
 
 conda create -n clone-py27env --clone py27env
 2. 进入虚拟环境
  conda activate <环境变量名>
  
 3. 查看环境: conda info --envs

标签:版本,python,anaconda,conda,tsinghua,https,edu,cn
From: https://www.cnblogs.com/ryujinx/p/17058591.html

相关文章