Anaconda使用虚拟环境

Anaconda使用虚拟环境,第1张

Anaconda使用虚拟环境
  • Anaconda
    • 查看已经存在的虚拟环境
    • 创建新的环境
    • 激活虚拟环境
    • 退出虚拟环境
    • 删除虚拟环境
    • 国内镜像源

Anaconda

Anaconda中的conda工具可以说是Python中较为方便的环境管理工具,下面介绍conda的相关 *** 作

查看已经存在的虚拟环境

查看目前已经存在的虚拟环境:

conda env list
创建新的环境

创建新的虚拟环境:

conda create -n your_virtual_env_name python=3.7
激活虚拟环境

查看目前已经存在的虚拟环境:

# Windows
activate your_virtual_env_name
# Linux
source activate your_virtual_env_name
退出虚拟环境
# Windows
deactivate your_virtual_env_name
conda deactivate
# Linux
source deactivate your_virtual_env_name
删除虚拟环境
conda remove -n  your_virtual_env_name --all
国内镜像源

显示镜像源

conda config --show channels

添加镜像源

conda config --add channels [urls…]
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 --set show_channel_urls yes

使用pip命令也可以使用镜像源加速下载

pip install package_name -i [urls…]
# 例如安装pandas库
pip install pandas -i https://pypi.tuna.tsinghua.edu.cn/simple

国内常用的镜像源:
阿里云:http://mirrors.aliyun.com/pypi/simple/
豆瓣:http://pypi.douban.com/simple/
清华大学 :https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学:http://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:https://pypi.hustunique.com/
山东理工大学:https://pypi.sdutlinux.org

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/738499.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-28
下一篇 2022-04-28

发表评论

登录后才能评论

评论列表(0条)

保存