File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import sys , os
2+ from textwrap import dedent
3+
4+ # 使用方法
5+ # 1. 右键终端以管理员模式运行
6+ # 2. base环境下 :python 此文件路径
7+ # 3. 打开conda文件夹,修改envs和pkgs(这个如果没有就建立)的用户权限全给了
8+
9+ text = dedent (f"""
10+ channels:
11+ - defaults
12+ show_channel_urls: true
13+ default_channels:
14+ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
15+ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
16+ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
17+ custom_channels:
18+ conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
19+ msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
20+ bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
21+ menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
22+ pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
23+ pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
24+ simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
25+ envs_dirs:
26+ - { sys .prefix } /envs
27+ pkgs_dirs:
28+ - { sys .prefix } /pkgs
29+ """ )
30+
31+ with open (f'{ os .path .expanduser ("~" )} /.condarc2' , 'w' , encoding = 'u8' ) as f :
32+ f .write (text )
33+
34+ print ('Successfully!' )
You can’t perform that action at this time.
0 commit comments