Anaconda常用操作
命令 | 例子 | 作用 |
---|---|---|
conda create -n 环境名 需要的库 | conda create -n pythonenv python=3.8 | 创建环境 |
conda info --envs | conda info --envs | 查看全部环境 |
activate 环境名 | activate pythonenv | 激活环境 |
conda deactivate | conda deactivate | 退出环境 |
conda remove -n 环境名 --all | conda remove -n pythonenv --all | 删除环境 |
conda create --name 新环境名 --clone 旧环境名 | conda create --name pythonnew --clone pythonenv | 克隆环境 |
conda config --show channels | conda config --show channels | 查看源 |
pip freeze > requirement.txt | pip freeze > requirement.txt | 生成requirement.txt文件 |
pip install -r requirement.txt | pip install -r requirement.txt | 导入环境 |
conda list / pip list | conda list / pip list | 查看环境内安装的库 |
conda install 包名 | conda install numpy | 安装包 |
conda update 包名 | conda update numpy | 更新包 |
conda uninstall 包名 | conda uninstall 包名 | 卸载包 |
conda update conda | conda update conda | 升级conda |
conda update anaconda | conda update anaconda | 升级anaconda |
添加清华镜像源:
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 --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/