Anaconda 创建虚拟环境相关命令

导读:本篇文章讲解 Anaconda 创建虚拟环境相关命令,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com

# Anaconda 创建虚拟环境
# 查看当前存在的虚拟环境
conda env list or conda info -e

# 创建虚拟环境
conda create -n 环境名 python=x.x

# 激活虚拟环境
# linux下/mac下
source activate 环境名
# windos下
activate 环境名

# 指定虚拟环境安装包
conda install -n 环境名 包名

# 指定虚拟环境下删除指定包
conda remove --name 环境名 包名

# 关闭虚拟环境
# linux下
source deactivate 环境名
# windos下
deactiavte 环境名
# 删除虚拟环境
conda remove -n 环境名 --all


# 安装包是镜像出错
1. 恢复配置
codna config --remove-key channels
2. 在配置镜像
conda config --add channels https://repo.continuum.io/pkgs/free/ 
conda config --add channels https://repo.continuum.io/pkgs/main/ 
conda config --set show_channel_urls yes
3.查看配置信息
conda config --show channels

# 镜像源
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣 http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

安装包的正确写法
临时使用:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  + 包名

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

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/98010.html

(0)
小半的头像小半

相关推荐

极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!