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盘

相关推荐
赵民勇21 分钟前
Python 协程详解与技巧总结
python
极光代码工作室33 分钟前
基于YOLO目标检测的智能监控系统
python·深度学习·yolo·机器学习·计算机视觉
江华森1 小时前
Python 进阶编程实战 — 从多版本环境到百万级登录系统
python
C+-C资深大佬1 小时前
python while循环
服务器·开发语言·python
zh路西法2 小时前
【现代控制理论与卡尔曼滤波】从状态空间到Python仿真实现
开发语言·python
Vodka~3 小时前
WSL2 + RViz GPU渲染机械臂
人工智能·python
8Qi83 小时前
hello-agents学习笔记--Memory让Agent拥有记忆
人工智能·python·llm·agent·ai编程·vibecoding
Esaka_Forever3 小时前
Python 完整内存管理机制详解
开发语言·python·spring
Weigang4 小时前
用 LlamaIndex 做 RAG 前,先把 Reader、Index、Retriever 的边界写清楚
人工智能·python·开源