当前位置:网站首页>切换 shell 命令行终端(bash/zsh)后,conda 无法使用: command not found
切换 shell 命令行终端(bash/zsh)后,conda 无法使用: command not found
2022-07-25 09:27:00 【Haulyn5】
前言
之前把 zsh 搞崩溃了,似乎是因为升级 GLIBC 导致 ohmyzsh 的一个主题崩了(locale 出了问题),然后就是 zsh 打不开,只能用 bash,敲入 zsh 就会 segment fault(本科课程实验要是能这么容易 fault 就好了)。于是卸载重装了 zsh,但是还是使用不了 zsh。只好迁移回 bash了。用了一段时间才发现 conda 用不成了……直接敲命令会显示 command not found。
找了一下,下面的博客给了思路。
正文
参考博客是从 bash 迁移到 zsh,而我是反过来,但是这篇博客中的 bash 目录和我不一样。文中使用的是一个叫 bash_profile 的文件,我这边没有这个文件,猜了一下是 `~/.bashrc` ,于是先进入 zshrc
vim ~/.zshrc大概会找到下面这一段
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/root/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/root/miniconda3/etc/profile.d/conda.sh" ]; then
. "/root/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/root/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<conda 很贴心的把属于自己的部分用注释标记出来了,把这一段拷贝到了 `~/.bashrc` 中。
vim ~/.bashrc然后 source 命令。
source ~/.bashrc
可以看到执行命令后,出现了 (base) 的 提示,这时候执行 conda 命令就一切如旧了。
边栏推荐
- Detailed explanation of JDBC operation database
- [deployment of deep learning model] deploy the deep learning model using tensorflow serving + tornado
- Es6详解
- Introduction to armv8 architecture
- SSM integration (simple library management system to integrate SSM)
- 关闭brew执行命令时的自动更新
- UE4 外部打开exe文件
- Pytorch 张量列表转换为张量 List of Tensor to Tensor 使用 torch.stack()
- canal实现mysql数据同步
- Redis使用场景
猜你喜欢

JDBC总结

GCD详解

链表相关(设计链表及环链表问题)

See how a junior student of double non-2 (0 Internship) can get an offer from Alibaba and Tencent

Detailed explanation of MySQL database

Configuring ROS development environment with vscode: Causes and solutions to the problem of ineffective code modification
![[necessary for growth] Why do I recommend you to write a blog? May you be what you want to be in years to come.](/img/f5/e6739083f0dce8da1d09d078321633.png)
[necessary for growth] Why do I recommend you to write a blog? May you be what you want to be in years to come.
![[nearly 10000 words dry goods] don't let your resume don't match your talent -- teach you to make the most suitable resume by hand](/img/2d/e3a326175f04826b9d9c96baedc3a5.png)
[nearly 10000 words dry goods] don't let your resume don't match your talent -- teach you to make the most suitable resume by hand

Probability theory and mathematical statistics 4 continuous random variables and probability distributions (Part 1)

Qt 6.2的下载和安装
随机推荐
IO流中的输入流
Pnpm Brief
Es6详解
Swing组件
Basic knapsack problem
数论---最大公约数最小公倍数
emmet语法速查 syntax基本语法部分
[necessary for growth] Why do I recommend you to write a blog? May you be what you want to be in years to come.
nodejs版本升级或切换的常用方式
UE4 外部打开exe文件
多线程——死锁和synchronized
静态路由的配置(以华为eNSP为例)
js数字千位分割的常用方法
Dataset 和 Dataloader数据加载
UE4 快速找到打包失败的原因
UE4源码的获取和编译
JS uses requestanimationframe to detect the FPS frame rate of the current animation in real time
Probabilistic robot learning notes Chapter 2
ES6 detailed explanation
shortest-unsorted-continuous-subarray