Conda 环境和更改镜像源
前言
记录常用的conda命令,快速修改conda环境
1,创建和修改镜像源
-
查看conda的环境目录
conda info --envs
-
激活一个conda环境
conda activate envs
-
创建conda环境
conda create -n envs_name python=3.7
-
删除环境
conda remove -n envs_name --all
2,使用镜像源
-
有时候我们会遇到第三方源找不到库的情况
ERROR: Could not find a version that satisfies the requirement xxx
-
这个可能是该源没有更新,导致安装失败,这个时候如果换了很多第三方源都安装不了时,我们就需要使用官方源进行安装
pip install numpy -i http://mirrors.aliyun.com/pypi/simple/ # 阿里云
pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple # 清华源
pip install numpy -i https://pypi.org/simple # 官方源
3,修改pip源
-
方法一
通过新建pip文件夹实现,首先在文件资源管理器中搜索 %APPDATA% ,新建一个pip文件夹,新建pip.txt文件,输入以下内容,然后保存,更改后缀为ini,完成。[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple -
方法二
或者直接输入以下命令也可以实现永久换源pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
3,修改 conda 源
-
方法一
在以下文件夹下找到 .condarc 文件,然后用文本打开,按照例子修改 channels 内容,然后保存即可。channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults -
方法二
在命令提示符中输入以下内容即可:conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.aliyun.com/pypi/simple/
conda config --set show_channel_urls yes
4,查看和还原
若想查看自己的 channel 有哪些,执行:
conda config --show channels
若想还原默认源,执行:
conda config --remove-key channels
5,常用的镜像源:
(1)豆瓣:http://pypi.douban.com/simple/
(2)阿里云 http://mirrors.aliyun.com/pypi/simple/
(3)清华大学:https://pypi.tuna.tsinghua.edu.cn/simple
(4)中国科学技术大学 : https://pypi.mirrors.ustc.edu.cn/simple
推荐阅读
-
Conda 在末尾替换了镜像源方法,不再需要搜索镜像源地址 [易于理解]。
-
更改 Ubuntu 系统的镜像源 [说明
-
[物联网部分 ] 12 - 联发科 MTK8516 开发环境设置 - MT8516 还支持多达 8 个 TDM 通道和 2 个 PDM 输入,以支持远场(Far-field)麦克风语音控制和智能音频设备的多源音频输入。
-
查看和切换 npm 镜像源
-
OpenSUSE 全新安装并更改阿里 OpenSUSE 镜像源✨ - - php中文网博客-二、OpenSUSE 全新安装?
-
紧急模式问题处理 - 图 1 紧急模式 根本原因分析 应急模式提供了尽可能小的环境,即使无法进入应急模式,也可以在其中修复系统。在应急模式下,系统只安装根文件系统供读取,不尝试安装任何其他本地文件系统,不激活网络接口,只启动一些基本服务。 进入应急模式的原因通常是 /etc/fstab 文件中存在错误,导致文件系统挂载失败。 文件系统中存在错误,导致。 约束和限制 本节适用于 Linux 操作系统紧急模式。程序涉及修复文件系统。修复文件系统有丢失数据的风险,因此请先备份数据,然后再执行修复操作。 处理方法 输入根密码,然后进入修复模式。 在应急模式下,根分区以只读模式挂载。要修改根目录中的文件,需要执行以下命令以读写模式重新挂载根分区。# mount -o rw,remount / 请执行以下命令首先检查 fstab 文件是否有误,然后尝试挂载所有未挂载的文件系统。# mount -a 如果挂载点不存在,请创建一个挂载点。 如果不存在此类设备,请注释或删除挂载行。 如果指定了不正确的挂载选项,请将挂载参数更改为正确的参数。 如果没有发生错误,但出现 UNEXPECTED INCONSISTENCY;RUN fsck MANUALLY 消息(通常是由文件系统错误引起的),请跳至第 7 步。 执行以下命令打开 /etc/fstab 以修改相应的错误。# vi /etc/fstab /etc/fstab 文件包含以下字段,以空格分隔:[文件系统] [dir] [type] [options] [dump] [fsck] 表 1 /etc/fstab 参数 说明 参数 说明 [文件系统] 要挂载的分区或存储设备。 文件系统]列建议以 UUID 的形式写入。执行 blkid 命令可查询设备文件系统 UUID。 参考格式如下: # <device> <dir> <type> <options> <dump> <fsck>; UUID=b411dc99-f0a0-4c87-9e05-184977be8539 /home ext4 defaults 0 2 使用 UUID 的好处是,它们与磁盘顺序无关。如果你在 BIOS 中更改了存储设备的顺序,或重新插入了存储设备,或者因为某些 BIOS 可能会随机更改存储设备的顺序,那么使用 UUID 会更有效率。 [文件系统] 文件系统]的挂载位置。 类型 挂载设备或分区的文件系统类型,支持多种不同的文件系统:ext2、ext3、ext4、reiserfs、xfs、jfs、smbfs、iso9660、vfat、ntfs、swap 和 auto。 设置为自动类型后,挂载命令会猜测所使用的文件系统类型,这对 CDROM 和 DVD 等移动设备非常有用。 选项 挂载时要使用的参数,有些参数是特定文件系统特有的。例如,默认值参数使用文件系统的默认挂载参数,ext4 的默认参数为:rw、suid、dev、exec、auto、nouser、async。 有关更多参数,请执行以下命令查看 man 手册:# man mount
-
如何更改 NPM 全局模式默认安装路径和 npm 镜像源设置
-
下载和使用 npm,并通过三种方式切换镜像源
-
如何使用 npm 设置镜像(包括在国外和国内镜像源之间切换)
-
使用 cnpm、设置 npm 镜像源和分发 npm 软件包--前言