Linux 下安装miniconda(少走弯路)

图片

Miniconda 和 Conda 都是用于管理 Python(及其他语言)环境和包的工具。

conda对于我来说是太臃肿了,很多的包我不使用,所以选择安装miniconda是一个较好的选择。

下面是linux安装miniconda的实际操作。少走弯路。

在以下的网站,选择你要安装的Miniconda的版本。

https://docs.conda.io/en/latest/miniconda.html#linux-installers

图片

1、下载安装包Miniconda3-latest-Linux-x86_64.sh

2、把安装包上传到服务器上,这里放在 /home/software

3、安装

bash Miniconda3-latest-Linux-x86_64.sh

4、按回车

图片

5、按空格跳到最下面,输入yes

图片

6、选择安装位置,这里选择默认,直接回车,有需要可以自己输入改掉

Miniconda3 will now be installed into this location: /root/miniconda3 - Press ENTER to confirm the location - Press CTRL-C to abort the installation - Or specify a different location below [/root/miniconda3] >>> PREFIX=/root/miniconda3

7、初始化 miniconda,输入 yes

installation finished. Do you wish the installer to initialize Miniconda3 by running conda init? [yes|no] [no] >>> yes

8、现在 conda 命令是找不到的,需要激活

source ~/.bashrc

激活后可以看到启动了 base 环境,conda 命令也可以用了,下一节会介绍常用 conda 命令。

9、可以设置启动时,不自动激活 base 环境

conda config --set auto_activate_base false

10、设置 conda 镜像源

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

11、设置 pip 镜像

pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
pip config set install.trusted-host mirrors.aliyun.com

12、查看 python 环境

(base) root@aa:/home/software# python
Python 3.12.4 | packaged by Anaconda, Inc. | (main, Jun 18 2024, 15:12:24) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('hello,rs')
hello,rs
>>> exit()

可以看到默认的 python 环境是 3.12,也就是我们安装的 miniconda 的 python 版本。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值