惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
Kaspersky official blog
T
Threat Research - Cisco Blogs
N
News and Events Feed by Topic
Hacker News: Ask HN
Hacker News: Ask HN
Project Zero
Project Zero
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 叶小钗
Security Latest
Security Latest
Spread Privacy
Spread Privacy
aimingoo的专栏
aimingoo的专栏
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
U
Unit 42
Cyberwarzone
Cyberwarzone
小众软件
小众软件
Scott Helme
Scott Helme
Engineering at Meta
Engineering at Meta
Microsoft Security Blog
Microsoft Security Blog
T
The Blog of Author Tim Ferriss
A
About on SuperTechFans
爱范儿
爱范儿
S
Schneier on Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Schneier on Security
Schneier on Security
Latest news
Latest news
GbyAI
GbyAI
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
The Register - Security
The Register - Security
WordPress大学
WordPress大学
博客园_首页
Blog — PlanetScale
Blog — PlanetScale
PCI Perspectives
PCI Perspectives
Jina AI
Jina AI
AI
AI
NISL@THU
NISL@THU
I
Intezer
G
GRAHAM CLULEY
B
Blog
S
Secure Thoughts
IT之家
IT之家
宝玉的分享
宝玉的分享
Recent Announcements
Recent Announcements
Y
Y Combinator Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
有赞技术团队
有赞技术团队
V2EX - 技术
V2EX - 技术
Recorded Future
Recorded Future
Hacker News - Newest:
Hacker News - Newest: "LLM"

博客园 - 不是豆豆

切换 Google Play 国家地区 NuGet 命令行记录 在 UnionTech OS Server 20 Euler 64bit 上安装 docker 环境 在 Windows 7 SP1 或 Windows Server 2008 R2 SP1 系统中安装 ASP.NET Core 10.0 运行时环境 记录各版本 Microsoft Visual C++ Redistributable 官方下载地址 在 PolarDB-PG 上安装 pgvector 扩展 在 microsoft onnxruntime 中使用 arcface model 出错:Invalid input scale: NumDimensions() != 3 在 Windows 下为 PostgreSQL 安装 pgvector 插件 如果两个 Steam 库文件夹中,有相同的两份游戏,这时删除第二份会怎样? 当 linux 主机内存较小运行程序(如 yum update)被 Killed 迁移 Gitea 从 Windows 到 Linux Docker 容器中(使用 SQLite 数据库) 在 EF Core 中使用传统的 DbFirst 模式 在 SkiaSharp 中对图片进行缩放时,结果锯齿较多的处理方案 在 asp.net core web 项目中,创建项目时因选择容器化部署,未配置 IIS Express 应如何进行修改 如何重置 sftpgo 的管理员密码 微信鸿蒙版 8.0.14 查询 navigator.maxTouchPoints 为 0 导致的 bug 在本地 claude code 中使用 copilot pro 订阅 在 .net framework 4.8 下,若因为安装或升级了 System.ValueTuple 出现问题 在 Windows 11 系统下,日常使用浏览器(Edge、Chrome)常遇到画面撕裂或浏览器在经切换窗口后显示内容不正常 关于 CVE-2025-55315 漏洞问题查验记录 在 gitea 服务器端查询 lfs 文件占用情况 编写 GKD 规则 在 Windows 下 .net 项目中,使用 ViGEm 模拟游戏手柄 为传统 .net framework 项目切换 nlog 日志 处理过大的 docker 日志 测试支持 PolarDB-X(高度兼容 MySQL) 的客户端图形工具 SteamDeck 重置系统密码教程 新版本 portainer ce 在操作容器时,报错 Forbidden - origin invalid
在安装 miniforge3(conda)环境后,每次启动终端(PowerShell)都非常缓慢的处理方案
不是豆豆 · 2026-01-26 · via 博客园 - 不是豆豆

处理方案收集自网络,原因是在执行 conda init 命令时

自动向 PowerShell 初始化文件中加了一段初始化 conda 环境的命令

在 PowerShell 环境中输入以下命令查看初始化文件所在位置:

$PROFILE

1、删除或注释该文件中以下代码

#region conda initialize
# !! Contents within this block are managed by 'conda init' !!
#If (Test-Path "X:\your\path\miniforge3\Scripts\conda.exe") {
#    (& "X:\your\path\miniforge3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | ?{$_} | Invoke-Expression
#}
#endregion

2、将文件中原代码封装为方法,在使用 conda 命令前单独执行初始化(方法名自定义,记得住就行)

#region conda initialize
function initconda() {
    # !! Contents within this block are managed by 'conda init' !!
    If (Test-Path "X:\your\path\miniforge3\Scripts\conda.exe") {
        (& "X:\your\path\miniforge3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | ?{$_} | Invoke-Expression
    }
}
#endregion

3、将原代码包装一层延迟启动,首次使用 conda 命令时会有所延迟

#region conda initialize

# 简单的 Conda 延迟加载
function Invoke-CondaInit {
    if (-not $script:CondaAlreadyInitialized) {
        Write-Host "Init Conda..." -ForegroundColor Yellow
        # !! Contents within this block are managed by 'conda init' !!
        If (Test-Path "X:\your\path\miniforge3\Scripts\conda.exe") {
            (& "X:\your\path\miniforge3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | ?{$_} | Invoke-Expression
        }
        $script:CondaAlreadyInitialized = $true
    }
}

# 只有在使用 conda 相关命令时才初始化
Set-Alias -Name conda -Value conda-wrapper
function conda-wrapper {
    Invoke-CondaInit
    conda @args
}

#endregion

参考来源:

https://v1hz.blog/post/e0be4916.html

https://alayedong.cn/posts/2025/fixing-slow-powershell-startup-caused-by-conda/#%E5%AE%9E%E7%8E%B0-conda-%E5%BB%B6%E8%BF%9F%E5%8A%A0%E8%BD%BD