使用conda创建python 虚拟环境

在cmd命令窗口,输入conda activate激活虚拟环境,可以看到默认为base,下面来介绍如何使用conda来创建python虚拟环境,因为在不同的工程中,对python等有不同版本需求,容易出现冲突。

1. 安装conda

(1)下载Anaconda

bash 复制代码
wget https://mirrors.bfsu.edu.cn/anaconda/archive/Anaconda3-2022.10-Linux-x86_64.sh --no-check-certificate

(2)安装 Anaconda

bash 复制代码
chmod +x Anaconda3-2022.10-Linux-x86_64.sh
./Anaconda3-2022.10-Linux-x86_64.sh

在安装过程中,需要阅读许可协议并接受,然后选择Anaconda的安装路径。默认情况下,Anaconda会安装在用户主目录下

(3)设置环境变量

bash 复制代码
source ~/.bashrc

(4)验证安装

bash 复制代码
conda --version

2. 查看当前存在的环境

bash 复制代码
conda env list

3. 创建虚拟环境

bash 复制代码
conda create -n env_name python=3.10
# env_name:环境名称,python版本

4. 激活环境

bash 复制代码
conda activate env_name 

5. 退出环境

bash 复制代码
conda deactivate

6. 删除环境

bash 复制代码
 conda remove -n env_name --all 

参考:conda创建python环境_conda create -n codellama python==3.10 -y-CSDN博客

相关推荐
敏编程10 小时前
一天一个Python库:tomlkit - 轻松解析和操作TOML配置
python
2401_8796938710 小时前
使用Python进行图像识别:CNN卷积神经网络实战
jvm·数据库·python
yunyun3212310 小时前
机器学习模型部署:将模型转化为Web API
jvm·数据库·python
团子和二花11 小时前
openclaw平替之nanobot源码解析(七):Gateway与多渠道集成
python·gateway·agent·智能体·openclaw·nanobot
未知鱼11 小时前
Python安全开发之简易目录扫描器(含详细注释)
开发语言·python·安全
Be1k011 小时前
推荐一款语雀知识库批量导出工具
python·gui·工具·语雀·批量导出·原创
Sunshine for you12 小时前
如何用FastAPI构建高性能的现代API
jvm·数据库·python
sthnyph12 小时前
MySQL 8.0在windows环境安装及配置
windows·mysql·adb
阿贵---12 小时前
Python Web爬虫入门:使用Requests和BeautifulSoup
jvm·数据库·python
Red丶哞12 小时前
内网自建Postfix使用Python发送邮件
开发语言·python