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版本。

相关推荐
特立独行的猫A1 小时前
用仓颉语言 cj-tauri 框架,五分钟给娃做了个鸿蒙形近字游戏
java·后端·python
大可不必了6 小时前
03 函数定义和调用
开发语言·python
承渊政道7 小时前
【Python编程—从入门到实践】(记分与闯关:用Python+Pygame,打造越战越精彩的太空大战!)
开发语言·python·pycharm·游戏程序·pygame
爱学习的程序媛7 小时前
Python常用框架梳理
开发语言·后端·python·ai·web·后端框架·python框架
imgsq7 小时前
GESP Python 一到四级:备考路线与真题特点
python·青少年编程
eggwyw8 小时前
Anaconda安装卸载的详细流程指南
开发语言·python
2601_967979129 小时前
纯手写:Python安装pip完整教程,搞了几小时,终于成功
python·教程·pip·安装·包管理
Norna9 小时前
缓存文件从没写出来:一个 .json 被当成目录用了
python
aifannihao11 小时前
AI 学习第 14 课:CNN 训 6 轮卡在 0.5352,数据没打乱
pytorch·python·深度学习·cnn·学习路线
yuyuxun112 小时前
协同过滤的校园二手物品智能推荐系统的设计与实现 毕业设计-附源码40082
javascript·vue.js·spring boot·python·数据分析·django·课程设计