Welcome to my bl|

Khru

园龄:2年11个月粉丝:22关注:1

2022-06-09 22:21阅读: 84评论: 0推荐: 0

Anaconda-配置环境常用命令

创建一个环境

conda create --name test python==3.8

 

查看所有环境

conda info -e

 

激活和退出环境

conda activate test
conda deactivate

 

删除环境

conda env remove --name test

 

更改 python 的版本

conda install python==3.9 -n test

 

查看 config

conda config --show

 或者 pip config

pip config list

 

添加 channels 

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
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/

 或者

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

 从 channels 中安装包时显示 channel 的 url 

conda config --set show_channel_urls yes

环境依赖设为灵活

conda config --set channel_priority flexible

 

移除 channels

conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

或者移除现有源

conda config --remove-key channels

 

查看环境中的包

conda list -n test
pip list

 

搜索包的信息

conda search scipy

 

安装包

conda install scipy==1.7.1
pip install scipy==1.7.1

或者用 -n 指定环境, -c 指定通过某个 channel 安装

conda install -n test scipy

 

更新包

conda update -n test scipy

 

卸载包

conda uninstall scipy

 或者

pip uninstall torch

 

更新 conda

conda update conda

 

批量安装包

在一个txt文件内填写需要的库的名字(==package_version)

C:
cd C:\Users\123\Desktop
conda install --file=test.txt

或者

pip install -r C:\Users\123\Desktop\test.txt

 

显示GPU的所有信息

nvidia-smi

 

检查 cuda 是否可用

python
import torch
torch.cuda.is_available()

 

退出python

exit()

或者

quit()

 

本文作者:Khru

本文链接:https://www.cnblogs.com/khrushchefox/p/16361425.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   Khru  阅读(84)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· winform 绘制太阳,地球,月球 运作规律
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起