Jupyter Notebook(Conda)中的python版本冲突 [英] Conflicting python version in jupyter notebook(Conda)

查看:235
本文介绍了Jupyter Notebook(Conda)中的python版本冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Conda设置Jupyter笔记本,但是笔记本使用的python版本与Conda环境不同.

I am trying to setup Jupyter notebook using Conda, but the python version being used by notebook is not the same as the Conda environment.

我使用以下命令创建了"python_jupyter"环境.

I used the following command to create the 'python_jupyter' environment.

conda create -n python_jupyter python=3.6.5 ipykernel

但是在笔记本中,当我检查python版本时,根据检查方式的不同,会得到不同的结果.如果我使用bash命令进行检查,则可以获得预期的版本号3.6.5,但是从python代码中,可以获得3.6.3(我猜这是默认的Conda安装随附的默认版本).

But in the notebook, when I check the python version I get different results depending on how I am checking it. If I check using bash command I get the expected version number 3.6.5, but from python code, I get 3.6.3(which I am guessing the default one came with default Conda installation).

当我回到基本"(默认)环境时,版本冲突已解决,

When I go back to the 'base'(default) environment, the version conflict is resolved,

为什么第一张图片中存在python版本冲突,我该如何解决?

Why there is a python version conflict in the first image, and how do I resolve it?

当我在'python_jupyter'环境处于活动状态的命令行上运行'conda info'时,我看到python版本被报告为3.6.3.但是如果我运行"python -V",我会看到python版本3.6.5.为什么会有这种差异?另外,当我尝试使用'conda update python'更新python时,它不会提示我进行更新,这意味着conda认为我使用的是最新的python版本3.6.5.

When I run 'conda info' on the command line with 'python_jupyter' environment active I see python version is being reported as 3.6.3. But if I run 'python -V' I see python version 3.6.5. Why this discrepancy? Also when I try to update python using 'conda update python' it doesn't prompt me for an update which means conda thinks I am on the latest python version 3.6.5.

推荐答案

问题是通过在python_jupyter环境中运行conda install ipython jupyter解决的.由于我能够使用默认安装运行jupyter notebook命令,因此我假设jupyter Notebook安装已完成.

The problem was solved by running conda install ipython jupyter on my python_jupyter environment. Since I were able to run jupyter notebook command with the default installation, I was under the assumption that jupyter notebook installation was complete.

conda info报告基本环境中的Python版本,conda listconda list -f pythonpython -V报告当前活动环境中的Python版本,在本例中为python_jupyter. 来源

conda info reports the version of Python in the base environment, and conda list or conda list -f python or python -V reports the version of Python in the currently active environment, in this case python_jupyter. Source

这篇关于Jupyter Notebook(Conda)中的python版本冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆