anaconda安装路径默认在D盘,但安装环境的envs路径跑到C盘,修改为D盘

安装的anaconda环境,路径是在anaconda安装目录下的envs中(D:\APPFile\Anaconda3\envs),然而,这次创建的却是在 C:\Users\xxx.conda\envs 中。

首先,找到用户目录下的.condarc文件(C:\Users\username)。修改为这样式儿的:

【没有的话,打开CMD窗口,创建 .condarc 配置文件

python 复制代码
conda config --set show_channel_urls yes

最后一行为环境所在路径,其他复制粘贴

python 复制代码
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
  pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

envs_dirs: 
  - D:\APPFile\Anaconda\envs

但是当新创建虚拟环境验证时,可能会发现它还是默认安装在C盘用户目录下的envs。

这时候需要修改D:\APPFile\Anaconda的权限:选中Anaconda3文件夹,然后右击选则属性,找到安全Users权限全部允许。接下来确定后,时间稍微有点长,等待完成即可。

【我也尝试了只修改envs文件的权限,但没用,不过可以先尝试一下修改envs文件的权限,不行的话可以改为修改anaconda文件的权限,有点慢且麻烦】

修改anaconda文件的权限时可能出现的问题:修改文件夹权限提示"无法枚举容器中的对象,访问被拒绝

这时新创建一个虚拟环境验证时,发现在D:\APPFile\Anaconda\envs下。

参考:
Anaconda修改环境默认位置
anaconda的envs路径跑到c盘了,修改为D盘

相关推荐
databook1 天前
Manim实现脉冲闪烁特效
后端·python·动效
程序设计实验室1 天前
2025年了,在 Django 之外,Python Web 框架还能怎么选?
python
倔强青铜三1 天前
苦练Python第46天:文件写入与上下文管理器
人工智能·python·面试
用户2519162427111 天前
Python之语言特点
python
刘立军1 天前
使用pyHugeGraph查询HugeGraph图数据
python·graphql
数据智能老司机1 天前
精通 Python 设计模式——创建型设计模式
python·设计模式·架构
数据智能老司机1 天前
精通 Python 设计模式——SOLID 原则
python·设计模式·架构
c8i1 天前
django中的FBV 和 CBV
python·django
c8i1 天前
python中的闭包和装饰器
python
这里有鱼汤2 天前
小白必看:QMT里的miniQMT入门教程
后端·python