anaconda配置环境

本文介绍了在Anaconda中创建新环境时遇到的错误,包括UnavailableInvalidChannel问题及其解决方案,涉及调整conda配置和使用国内镜像源。还涵盖了激活环境、安装与管理python包、虚拟环境与Jupyter的集成、查看与管理环境及包、以及如何切换和配置镜像源。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

anaconda创建新环境:

conda create -n env_name python=X.X

创建环境报错
UnavailableInvalidChannel: The channel is not accessible or is invalid.
channel name: simple
channel url: https://pypi.tuna.tsinghua.edu.cn/simple
error code: 404

You will need to adjust your conda configuration to proceed.
Use conda config --show channels to view your configuration’s current state,
and use conda config --show-sources to view config file locations.
由于之前手动安装过国内镜像源,所以考虑到镜像源不工作。
解决方法选自:https://blog.youkuaiyun.com/qq_41897154/article/details/116429352

conda config --remove-key channels
conda config --show channels

在这里插入图片描述

conda install tqdm

在这里插入图片描述

激活环境

activate env_name

python包:https://www.lfd.uci.edu/~gohlke/pythonlibs/
安装对应环境的包

conda install -n env_name package_name

本地安装

pip install C:\Users\xxx\Downloads\aaa.whl

更新包

pip install --upgrade xxx

卸载包

pip uninstall xxx

虚拟环境加到jupter

python -m ipykernel install --name paddle

或者

#在虚拟环境下
pip install ipykernel ipython
ipython kernel install --user --name pytorch1.6
pip install --user ipykernel
python -m ipykernel install --user --name=mypytorch

查看所有虚拟环境

conda info -e

删除虚拟环境

conda remove --name env_name --all

返回base

deactivate env_name

跳转其他虚拟环境

# 在命令行中切换到想要的虚拟环境,我这里切换到paddle
conda activate paddle

查看所有包

pip list

查看python版本

python -V

GWR常用包
在这里插入图片描述
在这里插入图片描述
镜像包

pip install pqi

切换镜像

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

查看镜像情况

conda config --show channels
#添加清华的源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
#移除镜像
conda config --remove channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'

中国科学技术大学 : https://pypi.mirrors.ustc.edu.cn/simple
豆瓣:http://pypi.douban.com/simple/
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科学技术大学:http://pypi.mirrors.ustc.edu.cn/simple/
华中科技大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
百度: https://simple.baidu.com/pypi/s

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值