欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

python问题:python interpreter is in a conda environment, but the environment has not been activate解决方法

程序员文章站 2022-06-09 17:03:59
1. 在学习python连接mysql时遇到下面的问题,我是直接安装了anaconda,里面内置了python3及很多插件,比起单独装python环境简单许多当我打开cmd,输入python时:问题如下所示:Warning:This Python interpreter is in a conda environment, but the environment hasnot been activated. Libraries may fail to load. To activate this...

1. 在学习python连接mysql时遇到下面的问题,我是直接安装了anaconda,里面内置了python3及很多插件,比起单独装python环境简单许多
当我打开cmd,输入python时:问题如下所示:

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

python问题:python interpreter is in a conda environment, but the environment has not been activate解决方法

2. 错误原因分析:环境未激活,库可能无法加载。激活这个环境

3. 解决方案如下(注:下面方案为一次性解决方案,再次打开cmd还是需要重新激活):
(1)首先检查自己环境变量中用户变量的path(根据自己anaconda的安装目录配置,一般安装时勾选配置环境变量)
python问题:python interpreter is in a conda environment, but the environment has not been activate解决方法
(2)在cmd控制台输入 conda info --envs,查看Anaconda的安装目录位置,复制安装目录位置信息
python问题:python interpreter is in a conda environment, but the environment has not been activate解决方法

(3)然后打开cmd控制台输入:conda activate Anaconda安装目录

将Anaconda中myenv库激活(根据自己Anaconda来调整):conda activate D:\software\anaconda3
python问题:python interpreter is in a conda environment, but the environment has not been activate解决方法
(3)当我再次输入python时,Anaconda中myenv库已经被成功激活,所以问题解决
python问题:python interpreter is in a conda environment, but the environment has not been activate解决方法
(4)当然了,这个方法也只是在当前命令窗口有效,如果觉得很麻烦每次激活的这一步骤,也可以搜索使用Anaconda Prompt这个应用
与cmd区别不大:Anaconda prompt更方便的切换到Anaconda 环境中,快捷键方式;而cmd通常并不是只针对Anaconda 环境的,之所以用起来区别不大,是因为添加了path路径的,让cmd也能有类似效果
python问题:python interpreter is in a conda environment, but the environment has not been activate解决方法
在这个应用中使用python命令是不会有警告出现的
python问题:python interpreter is in a conda environment, but the environment has not been activate解决方法

本文地址:https://blog.csdn.net/weixin_44422604/article/details/107658142

相关标签: Python anaconda