博文背景
原本我的conda貌似默认是直接安装然后换个源就好了,但是现在它貌似会将文件装在.conda目录下面,这会让我感觉很不适应,所以我得手动指定一下一些路径。
具体操作
什么情况下才会有这种操作?
答:Miniconda3为所有用户安装,但是以普通用户身份运行时。
default_channels:
- https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/r
- https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/main
custom_channels:
conda-forge: https://mirrors.sjtug.sjtu.edu.cn/anaconda/cloud/
pytorch: https://mirrors.sjtug.sjtu.edu.cn/anaconda/cloud/
channels:
- defaults
envs_dirs:
- C:\ProgramData\Miniconda3\envs
pkgs_dirs:
- C:\Users\liuwenwen\Miniconda3\pkgs
注意默认的C:\ProgramData\Miniconda3\pkgs目录对于普通用户是不可写的,所以需要新建一个自定义的可写目录。
pkgs_dirs是conda install xxx时缓存下载的包时使用的。
pkgs_dirs specify directories in which packages are located. If this key is set, the root prefix pkgs_dirs is not used unless explicitly included.
If the pkgs_dirs key is not set, then envs/pkgs is used as the pkgs cache, except for the standard envs directory in the root directory, for which the normal root_dir/pkgs is used.
The CONDA_PKGS_DIRS environment variable overwrites the pkgs_dirs setting:
For macOS and Linux: CONDA_PKGS_DIRS=/opt/anaconda/pkgs
For Windows: set CONDA_PKGS_DIRS=C:\Anaconda\pkgs