目录
8、需要注意的是,conda 没有提供重命名环境的命令,我们只能先克隆一份原来的环境,然后再删除原来的环境,具体操作如下(例如将环境 a 重命名成 b):
10、如果我们想要升级 my_env 下的 numpy 和 scipy
删除之前原有的镜像源(所有的)
conda config --remove-key channels
查看镜像源
conda config --show-sources
常用的镜像源
清华镜像源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
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/r
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
中科大
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/
北京外国语
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/main
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/r
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/pro
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/msys2
阿里云
conda config --add channels https://mirrors.aliyun.com/pypi/simple/
conda常用指令
1、创建一个环境:
conda create -n [环境的名字] python==3.8[版本自选]
2、查看所安装的环境
conda info -e
3、进入自己所创建的环境(方便进行安装自己所需要的包)
conda activate [环境名字]
如果出现连接错误可以执行下面指令:
conda create -n yolov8 python==3.8 --override-channels -c conda-forge
4、查看环境中所安装的包
conda list -n [环境的名字]
5、查看当前环境中所安装的包(已进入当前环境)
conda list
6、删除环境中的某一个包
conda remove -n [环境名字] [某个包名字]
7、删除环境中所有的包(整个环境)
conda remove -n [环境名字] --all
或者
conda remove --all
8、需要注意的是,conda 没有提供重命名环境的命令,我们只能先克隆一份原来的环境,然后再删除原来的环境,具体操作如下(例如将环境 a
重命名成 b
):
conda create -n b --clone a
conda remove -n a --all
9、退出该环境,只需执行
conda deactivate
10、如果我们想要升级 my_env 下的 numpy 和 scipy
conda update -n my_env numpy scipy
11、如果我们要想更新 my_env 中的所有包
conda update -n my_env --all
12、如果要更新 conda 本身,则需执行
conda update conda
13、如果要更新 anaconda ,则需执行
conda update anaconda
14、将当前的conda环境导出为一个文件
conda env export --no-builds > requirements.yml
15、通过该文件创建相应的conda环境
conda env create -f requirements.yml
16、导出 requirements.txt
pip freeze > requirements.txt
17、安装requirements.txt
( -i https://pypi.tuna.tsinghua.edu.cn/simple是镜像源,可以加可以不加,加上之后下载的速度会更快)
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
conda下目录的切换
1、进入 D盘
2、切换到D盘的某一个文件夹下
3、返回上一级
查看cuda版本:
nvidia-smi