conda
2023-04-09 本文已影响0人
EnjoyWT
//克隆oldname环境为newname环境
conda create --name newname --clone oldname
//彻底删除旧环境
conda remove --name oldname --all
激活命令
conda activate #默认激活base环境
conda activate xxx #激活xxx环境
conda deactivate #关闭当前环境
conda config --set auto_activate_base false #关闭自动激活状态
conda config --set auto_activate_base true #关闭自动激活状态
查看 电脑上所有 虚拟环境, 配合以上命令 进行维护
conda info -e
或
conda env list
···
数据源维护
显示目前pip的数据源有哪些
pip config list
pip config list --[user|global] # 列出用户|全局的设置
pip config get global.index-url # 得到这key对应的value 如:https://mirrors.aliyun.com/pypi/simple/
添加
pip config set key value
#添加数据源:例如, 添加USTC中科大的源:
pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/web/simple
#添加全局使用该数据源
pip config set global.trusted-host https://mirrors.ustc.edu.cn/pypi/web/simple
删除
pip config unset key
例如
conda config --remove channels
https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
搜索
pip search flask #搜素flask安装包
升级pip
pip install pip -U
环境依赖生成
python3 -m pip freeze > requirements.txt
安装
python3 -m pip install -r requirements.txt