Linux 下安装miniconda(少走弯路)

打印 上一主题 下一主题

主题 1549|帖子 1549|积分 4647


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、安装
  1. bash Miniconda3-latest-Linux-x86_64.sh
复制代码
4、按回车


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


6、选择安装位置,这里选择默认,直接回车,有需要可以本身输入改掉
  1. Miniconda3 will now be installed into this location:
  2. /root/miniconda3
  3. - Press ENTER to confirm the location
  4. - Press CTRL-C to abort the installation
  5. - Or specify a different location below
  6. [/root/miniconda3] >>>
  7. PREFIX=/root/miniconda3
复制代码
7、初始化 miniconda,输入 yes
  1. installation finished. Do you wish the installer to initialize Miniconda3 by running conda init?
  2. [yes|no] [no] >>> yes
复制代码
8、现在 conda 命令是找不到的,需要激活
  1. source ~/.bashrc
复制代码
激活后可以看到启动了 base 环境,conda 命令也可以用了,下一节会介绍常用 conda 命令。
9、可以设置启动时,不自动激活 base 环境
  1. conda config --set auto_activate_base false
复制代码
10、设置 conda 镜像源
  1. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  2. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
复制代码
11、设置 pip 镜像
  1. pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
  2. pip config set install.trusted-host mirrors.aliyun.com
复制代码
12、检察 python 环境
  1. (base) root@aa:/home/software# python
  2. Python 3.12.4 | packaged by Anaconda, Inc. | (main, Jun 18 2024, 15:12:24) [GCC 11.2.0] on linux
  3. Type "help", "copyright", "credits" or "license" for more information.
  4. >>> print('hello,rs')
  5. hello,rs
  6. >>> exit()
复制代码
可以看到默认的 python 环境是 3.12,也就是我们安装的 miniconda 的 python 版本。




免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

前进之路

论坛元老
这个人很懒什么都没写!
快速回复 返回顶部 返回列表