Anaconda常用命令及pip镜像源

一、Anaconda创建、删除
1. 创建虚拟环境

conda create -n your_env_name python=x.x
# 在创建环境的同时安装必要的包
conda create -n your_env_name numpy matplotlib python=x.x
# 在指定的虚拟环境中安装额外的包
conda install -n your_env_name package_name
# 克隆虚拟环境
conda create --name python32(新名字) --clone python321(老名字)

2. 激活虚拟环境

activate your_env_name
# 退出当前环境
deactivate your_env_name
OR
conda deactivate

3. 删除虚拟环境

conda remove -n your_env_name --all
# 删除虚拟环境中的某个包:
conda remove --name your_env_name package_name

二、conda常用指令
1. 查看conda版本

conda -V

2. 查看安装了哪些包

conda list
pip list

3. 查看当前存在哪些虚拟环境

conda env list
conda info -e

4. 检查更新当前conda

conda update conda

5. 设置国内镜像
conda下载东西时,默认的镜像源下载的速率很慢,修改conda的镜像源能够加快下载速度。一些设置镜像的操作如下:
(1).查看已添加的镜像

conda config --get channels


(2).换回默认镜像

conda config --remove-key channels


(3).添加清华镜像

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


在添加镜像时选择其中任意一个即可
(4).设置搜索时显示频道地址

conda config --set show_channel_urls yes 


(5).删除指定镜像

conda config --remove channels 地址


(6).确认镜像添加成功

conda config --get channels

pytorch安装检验

import torch
print(torch.__version__)
print(torch.cuda.is_available())


pip临时更换镜像源

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple name


永久

## 配置中科大镜像
pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/web/simple
# 配置阿里源
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
# 配置腾讯源
pip config set global.index-url http://mirrors.cloud.tencent.com/pypi/simple
# 配置豆瓣源
pip config set global.index-url https://pypi.douban.com/simple/
# 查看当前镜像源
pip config list

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

梦想就是摸鱼

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值