阿里云 linux Centos7 安装 Miniconda3 + 创建Python环境

1.下载miniconda

(1)法一:可以去下载清华源的miniconda镜像源,选择自己需要的版本,然后上传到Linux服务器上,linux上使用请选择linux版本,如下:

**(2)**法二:在linux下的某一目录下,使用wget获取源文件,wget后面的地址就是上图中鼠标右击复制得到的,这种方式省去了上传的步骤。

bash 复制代码
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py310_23.9.0-0-Linux-x86_64.sh 

2、安装miniconda

(2-1)启动安装脚本进行安装

bash 复制代码
bash  Miniconda3-py310_23.9.0-0-Linux-x86_64.sh

安装过程中,出现如下直接按【Enter】键,然后后续按【空格键】快速略过一些说明。

(2-2)遇到此处,输入【yes】,然后回车

(2-3)设置miniconda安装路径

(2-4)遇到此处,输入【yes】,然后回车,直到安装完成

3、验证miniconda是否安装成功

关闭终端,重新连接(否则不能查看conda的版本的信息),验证conda是否安装成功

(3-1)终端输入如下命令,会出现对应的版本号;

bash 复制代码
conda -V  

(3-2)输入python,会显示当前base环境的python版本号

bash 复制代码
python

4、配置conda的镜像源

(4-1)先查看miniconda的镜像源,一般输出是空的,命令行输入:

bash 复制代码
 conda config --show-sources

(4-2)添加镜像源,命令行输入:

bash 复制代码
conda config --set show_channel_urls yes
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/free/ 
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/main/ 
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge/ 
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/pytorch/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/bioconda/

(4-3)再次执行(4-1)的指令,会出现如下信息

5、创建一个新的python环境

(5-1) -n env ==> 表示创建的新环境名字为env;

(5-2)python=3.8 ==> 表示新环境的python版本号为3.8

bash 复制代码
conda create -n env python=3.8

6、激活环境

bash 复制代码
conda activate env

激活环境后,命令行的会从原来的(base)更改为(env),表示新的环境激活成功。

7、退出环境

bash 复制代码
conda deactivate

8、查看本地存在的python环境

bash 复制代码
conda info --envs

如下是我本级存在的两个python环境base和env

相关推荐
默_笙4 天前
🍙 给每个请求过安检:FastAPI 是怎么把校验写进类型注解的
python
未济4 天前
linux 配置环境变量
linux
傲世仙尊4 天前
目录即文件-Ext文件系统收尾篇
linux·c语言
qq_426003964 天前
启动playwright录制codegen生成自动化测试脚本
python·自动化
虎头金猫4 天前
4K 视频总卡在公网带宽?用 N1 + OpenList 把网盘播放链路重新理顺
运维·服务器·网络·python·容器·beautifulsoup·pandas
长沙三为智能科技4 天前
家政小程序开发从0到上线:五阶段交付流程与验收清单
python
伞伞悦读4 天前
【第38期】Python 模块与包详解:import、from、模块搜索路径、包结构和 __init__
开发语言·python
只睡四小时4 天前
Canvas 弹道联机实战:700 行 + 固定时间步长
python·websocket·html5·游戏开发·canvas
_艾伦 耶格尔.4 天前
进程间通信
linux
Liuqy-054 天前
Linux IO编程——静态库、动态库
linux