Python全系列 教程
3567个小节阅读:5929.6k
目录
鸿蒙应用开发
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
conda是一个开源的包、环境管理器,可以用于在同一个机器上安装不同Python版本的软件包及其依赖,并能够在不同的Python环境之间切换,Anaconda包括Conda、Python以及一大堆安装好的工具包,比如:numpy、pandas等,Miniconda包括Conda、Python。
此处,我们不需要如此多的工具包,故选择MiniConda。
使用root用户后续会遇到各种问题,我们使用itbaizhan用户操作。
添加用户itbaizhan
xxxxxxxxxx
[root@node4 ~]# useradd itbaizhan
[root@node4 ~]# passwd itbaizhan #密码也设置为itbaizhan
创建目录/opt/module,并需改所属用户组和用户
xxxxxxxxxx
[root@node4 ~]# mkdir /opt/module
[root@node4 ~]# chown -R itbaizhan:itbaizhan /opt/module/
将Miniconda3-latest-Linux-x86_64.sh上传到node4的/home/itbaizhan目录
xxxxxxxxxx
[root@node4 ~]# su itbaizhan
[itbaizhan@node4 root]$ cd
[itbaizhan@node4 ~]$ ls
Miniconda3-latest-Linux-x86_64.sh
执行安装脚本
xxxxxxxxxx
[itbaizhan@node4 ~]# bash Miniconda3-latest-Linux-x86_64.sh
In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>> #安装Enter键 然后按空格键
Do you accept the license terms? [yes|no]
[no] >>> yes #输入yes,然后按下Enter键
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
#输入安装路径
[/home/itbaizhan/miniconda3] >>> /opt/module/miniconda3
Do you wish the installer to initialize Miniconda3
by running conda init? [yes|no]
[no] >>> yes #输入yes初始化然后按下Enter键
Thank you for installing Miniconda3!
加载环境变量配置文件,使之生效
xxxxxxxxxx
[itbaizhan@node4 ~]$ source ~/.bashrc
(base) [itbaizhan@node4 ~]$
取消激活base环境
Miniconda安装完成后,每次打开终端都会激活其默认的base环境,我们可通过以下命令,禁止激活默认base环境。
xxxxxxxxxx
(base) [itbaizhan@node4 ~]$ conda config --set auto_activate_base false
(base) [itbaizhan@node4 ~]$
配置conda镜像
xxxxxxxxxx
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
安装python环境
xxxxxxxxxx
[itbaizhan@node4 ~]# conda create -n superset python=3.9.15
Proceed ([y]/n)? y
补充:conda环境管理命令
创建环境:conda create -n env_name
查看所有环境:conda info -e / --envs
激活环境:conda activate env_name
取消激活:conda deactivate
在当前激活环境中
删除环境:conda remove -n env_name --all
激活superset环境
xxxxxxxxxx
[itbaizhan@node4 ~]# conda activate superset
(superset) [itbaizhan@node4 ~]# conda deactivate #取消激活