使用Anaconda创建一个python环境

一、安装Anaconda

    安装好后,在cmd中,输入python命令,发现一个warning ,提示我们需要激活这个环境:

Python 3.7.4 (default, Aug  9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32

Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated.  Libraries may fail to load.  To activate this environment
please see https://conda.io/activation

Type "help", "copyright", "credits" or "license" for more information.

   在Anaconda中加入清华镜像:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
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/pkgs/free/
conda config --set show_channel_urls yes

二、用Anaconda创建一个python环境

     打开命令窗口,输入以下命令:

      conda create --name python37 python=3.7

    或者打开左下角的anaconda导航栏,在页面上进行创建

如果在create的时候发现报错:CondaHTTPError,采用以下办法来解决:

找到.condarc文件,将

 去掉-default,然后保存

重新create: 

虚拟环境就创建成功了!

2)接下来就要激活环境

   >conda info --env  查看环境的命令

  激活命令:  conda activate python37

就这样一个环境就创建成功了!

参考博客:

https://blog.csdn.net/ebzxw/article/details/80702506

https://blog.csdn.net/zt7524/article/details/90766123

发布了53 篇原创文章 · 获赞 45 · 访问量 8843

猜你喜欢

转载自blog.csdn.net/qq_33036061/article/details/104329997