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 命令是找不到的,需要激活
激活后可以看到启动了 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 版本。
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |