前进之路 发表于 2025-3-30 20:59:33

Linux 下安装miniconda(少走弯路)

https://i-blog.csdnimg.cn/blog_migrate/c9d69ca216a00239e96bfef8f29ef93a.png
Miniconda 和 Conda 都是用于管理 Python(及其他语言)环境和包的工具。
conda对于我来说是太臃肿了,很多的包我不会使用,以是选择安装miniconda是一个较好的选择。
下面是linux安装miniconda的实际操作。
在以下的网站,选择你要安装的Miniconda的版本。
https://docs.conda.io/en/latest/miniconda.html#linux-installers

https://i-blog.csdnimg.cn/blog_migrate/df96c43046825454f72c957f748ee441.png
1、下载安装包Miniconda3-latest-Linux-x86_64.sh
2、把安装包上传到服务器上,这里放在 /home/software
3、安装
bash Miniconda3-latest-Linux-x86_64.sh 4、按回车

https://i-blog.csdnimg.cn/blog_migrate/6742f8d1f30f01350a866843e1a931b9.png
5、按空格跳到最下面,输入yes

https://i-blog.csdnimg.cn/blog_migrate/35f3630908c4881f4689a4923137d8e1.png
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

>>>
PREFIX=/root/miniconda3 7、初始化 miniconda,输入 yes
installation finished. Do you wish the installer to initialize Miniconda3 by running conda init?
>>> 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) on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('hello,rs')
hello,rs
>>> exit() 可以看到默认的 python 环境是 3.12,也就是我们安装的 miniconda 的 python 版本。




免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: Linux 下安装miniconda(少走弯路)