Miniconda3教程

Miniconda3

1.安装

  1. Miniconda3官网获取链接,在下载目录执行:
powershell 复制代码
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

没有weget,先安装

powershell 复制代码
yum -y install wget
  1. 在安装目录执行命令,开始安装
powershell 复制代码
bash Miniconda3-latest-Linux-x86_64.sh
  1. 选择安装路径
    选择安装目录,如果无需更改直接回车Enter,如需更改要输入绝对路径:

Anaconda3 will now be installed into this location:

/home/work/anaconda3

-- Press ENTER to confirm the location

-- Press CTRL-C to abort the installation

-- Or specify a different location below

  1. 问是否需要进行conda的初始化,建议输入no。若选择yes,是在/root/.bashrc目录中自动添加环境变量,会使得开机自动启动base环境。
  2. 最后安装成功出现以下内容
powershell 复制代码
To activate conda's base environment in your current shell session:
eval "$(/miniconda3/bin/conda shell.YOUR_SHELL_NAME hook)" 
To install conda's shell functions for easier access, first activate, then:
conda init
If you'd prefer that conda's base environment not be activated on startup, 
   set the auto_activate_base parameter to false: 
conda config --set auto_activate_base false
Thank you for installing Miniconda3!

要在当前shell会话中激活conda的基本环境:eval "$(/miniconda3/bin/conda shell。"YOUR_SHELL_NAME钩);如果您不希望在启动时激活conda的基本环境,请将auto_activate_base参数设置为false: conda config------set auto_activate_base false感谢您安装Miniconda3!

2.常用命令

1.激活|退出

source ./miniconda3/bin/activate env_name 激活指定环境

conda deactivate 退出miniconda

2.自定义快捷键

若想平时不在conda环境,则需要将.bashrc文件中的conda设置内容注释 。 平时在~/miniconda3/bin/下执行 source activate就可使用conda了。 更便捷的方法是在~/.bashrc 下添加 :

alias condaac='source ~/miniconda3/bin/activate'

alias condadac='conda deactivate'

3.添加镜像

powershell 复制代码
#添加镜像(清华源)
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/
conda config --set show_channel_urls yes 
#查看
conda config --get channels
or
cat ~/.condarc

4.创建python虚拟环境

默认创建到miniconda安装目录下的envs里

powershell 复制代码
conda create -n py38 python=3.8     # -n是name的缩写,python不指定版本就默认最新版

5.查看已经安装的虚拟环境列表

powershell 复制代码
conda env list

6.删除虚拟环境

powershell 复制代码
conda env remove -n Test1

7.安装库

使用conda安装指定版本的库:使用conda install命令安装指定版本的库。例如,要安装Python 3.6版本的numpy库,可以使用以下命令:

powershell 复制代码
conda install numpy=1.18.5 python=3.6
conda install numpy python=3.8

这将从Conda仓库中下载并安装指定版本的numpy库及其所有依赖项。请注意,您需要指定要安装的库的名称和版本号,并且如果要安装特定版本的库,则需要指定要使用的Python版本。

相关推荐
Psycho_MrZhang42 分钟前
高并发服务设计思路
python
多米Domi0111 小时前
0x3f 第21天 三更java进阶1-35 hot100普通数组
java·python·算法·leetcode·动态规划
小程故事多_801 小时前
从零吃透PyTorch,最易懂的入门全指南
人工智能·pytorch·python
Keep_Trying_Go2 小时前
基于无监督backbone无需训练的类别无关目标统计CountingDINO算法详解
人工智能·python·算法·多模态·目标统计
weixin_433179333 小时前
python - for循环,字符串,元组基础
开发语言·python
^哪来的&永远~3 小时前
Python 轻量级 UI:EEG 与 fNIRS 预处理图形界面
python·可视化·功能连接·eeg·mne·fnirs·eeglab
AI大佬的小弟3 小时前
Python基础(11):Python中函数参数的进阶模式详解
python·lambda函数·函数的参数解释·函数的参数进阶·位置参数·关键词参数·匿名函数与普通函数
智算菩萨3 小时前
Python可以做哪些小游戏——基于Python 3.13最新特性的游戏开发全指南(15万字超长文章,强烈建议收藏阅读)
python·pygame
智航GIS3 小时前
9.1 多线程入门
java·开发语言·python
nvd113 小时前
FastMCP 开发指南: 5分钟入门
人工智能·python