您的位置 首页 python

conda 命令

conda常见操作



conda --version

0-查看源地址:

conda config --show channels

查看安装的包名:

conda list

 

0-列出 环境:

conda env list
  
conda info --envs

 

1-创建虚拟环境

conda create -n myenv python=3.8.2

2-删除环境:

conda remove -n myenv --all

3- 指定环境中安装包

conda install --name <env_name> <package_name>

4- 进入 conda 环境

conda activate myenv

退出:

conda deactivate

 

安装

正式虚拟环境

    conda activate myenv
    conda install numpy
	python --version
	python
	exit()
	conda deactivate

 

docker 中激活环境:

#!/bin/bash
logfile=/tmp/sms_aliyun.log

echo "Current user is $(whoami)" >> $logfile

#sudo -i -u root
# 激活 Conda 环境

#conda activate smspy3
 source  /home/conda1/miniconda3/bin/activate  smspy3 




startTime=`date +%Y%m%d-%H:%M:%S`

echo $startTime >> $logfile
# 调用 Python 脚本
#python /etc/zabbix/alertscripts/pyscripts/gaojing.py "$1" "$2"
#python /etc/zabbix/alertscripts/pyscripts/gaojing.py "$1" 
python /etc/zabbix/alertscripts/pyscripts/sms.py "$1" "$2" "$3"

echo $return_value >> $logfile
echo "----------------arg1 --------------" >>  $logfile
echo  $1 >> $logfile
echo "----------------arg2 --------------" >>  $logfile
echo  $2 >> $logfile
echo "----------------arg3 --------------" >>  $logfile
echo  $3 >> $logfile
echo "----------------arg4 --------------" >>  $logfile
echo  $4 >> $logfile
# 退出 Conda 环境
#/home/conda1/miniconda3/bin/conda deactivate

 

欢迎来撩 : 汇总all

白眉大叔

关于白眉大叔linux云计算: 白眉大叔

热门文章