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盘

相关推荐
AI_56785 小时前
Selenium+Python可通过 元素定位→操作模拟→断言验证 三步实现Web自动化测试
服务器·人工智能·python
蒜香拿铁6 小时前
【第三章】python算数运算符
python
52Hz1187 小时前
力扣73.矩阵置零、54.螺旋矩阵、48.旋转图像
python·算法·leetcode·矩阵
weixin_462446238 小时前
Python 使用 openpyxl 从 URL 读取 Excel 并获取 Sheet 及单元格样式信息
python·excel·openpyxl
毕设源码-钟学长9 小时前
【开题答辩全过程】以 基于Python的健康食谱规划系统的设计与实现为例,包含答辩的问题和答案
开发语言·python
百***78759 小时前
Grok-4.1技术深度解析:双版本架构突破与Python API快速集成指南
大数据·python·架构
2501_9421917710 小时前
基于YOLO11-HSFPN的数字检测与识别模型实现详解
python
忧郁的橙子.11 小时前
26期_01_Pyhton基本语法
python
sunfove11 小时前
实战篇:用 Python 徒手实现模拟退火算法解决 TSP 问题
开发语言·python·模拟退火算法
我是菜鸟0713号12 小时前
Qt + Python 算法集成的一种低耦合实践:FastAPI 服务化方案
python·qt·fastapi